Mercurial > bugzilla-dashboard
annotate js/tests.js @ 108:3ad618d3370f
refactored new Automator class into js/black-box.js.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Fri, 30 Apr 2010 04:52:17 -0700 |
parents | eb2cc1f89869 |
children |
rev | line source |
---|---|
36
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
1 function raises(error, func, message) { |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
2 if (!message) |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
3 message = "function raises error: " + error; |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
4 |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
5 try { |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
6 func(); |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
7 ok(false, message + " (no error was raised)"); |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
8 } catch (e) { |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
9 equals(e.message, error, message); |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
10 } |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
11 } |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
12 |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
13 $(window).ready(function runTests() { |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
14 for (name in window) { |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
15 if (name.match(/^test.+/) && |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
16 name != "testDone" && |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
17 name != "testStart" && |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
18 typeof(window[name]) == "function") { |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
19 test(name, window[name]); |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
20 } |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
21 } |
eb2cc1f89869
Added a test suite, basic CommonJS module loader, and a new main.html file that will be a unified UI to all three pages (dashboard, user-finder, bug-filer).
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
22 }); |