spooq wrote:

> Could you let me know how the perl script is going, either here or off-list?

Awesome - it works perfectly as a lexer, and it only produces two tiny
bugs (so far). One is 'new Ajax.Updater' doesn't fly, and you need 'ajax =
new Ajax.Updater'. The other is you gotta have a ; on the ends of lines.

So here's a sample test case. I am attempting to test-FIRST Javascript
(thru Rails). That's much harder than just acceptance-testing it thru the
existing test rigs, but the rewards will be substantial.

    assert_xpath '/form/textarea' do |textarea|
      assert_js textarea.attributes['onkeydown'] do
        assert_xpath 'Statement[1]' do
          assert_xpath '//Identifier[ @name = "Callee" and . = "editor_keydown" ]'
        end
      end
    end

assert_xpath asserts that the hidden @xdoc variable can call XPath.first()
on the given string without returning nil. So you can pack lots of goodies
into your XPath strings, including queries and string comparisons.

The first assert_xpath calls after something generated XHTML and then
loaded it into @xdoc. So we can assert this XHTML contains a FORM
containing a TEXTAREA.

assert_js just copies the given Javascript into a temporary file, calls
jsToXml.pl on it, and loads this into @xdoc.

The above test case trivially tests that <TEXTAREA
onkeydown='editor_keydown(event);' ...>. That looks too trivial to
test-first, but it's the little things that add up into big bugs if you
don't apply a little rigor to your development process!

-- 
  Phlip