JavaScript:SpiderMonkey:JS Tests

From MozillaWiki
Revision as of 05:31, 31 August 2006 by Crowder (talk | contribs) (Compiled by crowder from an IRC convo with bclary)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Rules for Writing JavaScript Test Cases

  • Use reportCompare() to report success/failure!
  • If your test will always throw an uncaught exception then you should name it with a suffix -n; it is always preferable to catch and handle exceptions directly.
  • Don't use print(), use printStatus() or writeLineToLog(), etc.
  • The tests will also be run in the browser in addition to the shell. If you use shell only features, detect that and let the browser report success.
  • Do the converse, if you have a browser-only test.