- From: Bjoern Hoehrmann <derhoermi@gmx.net>
- Date: Mon, 14 Nov 2011 01:56:14 +0100
- To: Bjoern Hoehrmann <derhoermi@gmx.net>
- Cc: www-archive@w3.org
* Bjoern Hoehrmann wrote: > The other day I read some bizarre discussion about JavaScript testing >frameworks for specification compliance and figured I'll take an hour to >make a framework and a test suite. I took `XMLSerializer` and the unbe- >lievably badly designed and implemented `DOMParser` as test subjects, >largely as implemented with a feature addition, you can specify an error >handler (a DOMErrorHandler as defined in DOM Level 3 Core) in the object >constructor so you actually can tell errors apart from parsing some bi- >zarre error document (though all but one test should pass with the old >error handling behavior, or something like that). I updated this a bit and put it up <http://shadowregistry.org/js/misc/>. I might try to add what other tests I have floating around. At least it is very simple to add tests, just add something like // XPath root path always identifies root node var doc = new DOMParser().parseFromString("<y/>", "text/xml"); var elm = doc.createElement("t"); var re1 = doc.evaluate("/", doc, null, 9, null); var re2 = doc.evaluate("/", elm, null, 9, null); return re1.singleNodeValue === re2.singleNodeValue; to a text file, no need to link specifications or encode author meta data or writing description text or anything else. Adding comparative data could be automized with some "submit data" button, which I haven't done yet. Whether a test is correct is easy to tell by looking at the comparative data and checking the code when in doubt, which is easy as the tests are written with ease of review in mind. -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de 25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Received on Monday, 14 November 2011 00:56:39 UTC