mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 873126: integrate Assert.jsm into XPCShell-test. r=gps
This commit is contained in:
parent
fb38092206
commit
fe46a8bf89
@ -278,4 +278,14 @@ function run_test() {
|
||||
} catch (e) {
|
||||
assert.equal(e.toString().split("\n")[0], "AssertionError: oh no")
|
||||
}
|
||||
|
||||
// Export Assert.jsm methods to become globally accessible.
|
||||
export_assertions();
|
||||
|
||||
// Test XPCShell-test integration:
|
||||
ok(true, "OK, this went well");
|
||||
deepEqual(/a/g, /a/g, "deep equal should work on RegExp");
|
||||
deepEqual(/a/igm, /a/igm, "deep equal should work on RegExp");
|
||||
deepEqual({a: 4, b: "1"}, {b: "1", a: 4}, "deep equal should work on regular Object");
|
||||
deepEqual(a1, a2, "deep equal should work on Array with Object properties");
|
||||
}
|
||||
|
@ -352,6 +352,24 @@ function _execute_test() {
|
||||
// _TEST_FILE is dynamically defined by <runxpcshelltests.py>.
|
||||
_load_files(_TEST_FILE);
|
||||
|
||||
// Support a common assertion library, Assert.jsm.
|
||||
let Assert = Components.utils.import("resource://testing-common/Assert.jsm", null).Assert;
|
||||
// Pass a custom report function for xpcshell-test style reporting.
|
||||
let assertImpl = new Assert(function(err, message, stack) {
|
||||
if (err) {
|
||||
do_report_result(false, err.message, err.stack);
|
||||
} else {
|
||||
do_report_result(true, message, stack);
|
||||
}
|
||||
});
|
||||
// Allow Assert.jsm methods to be tacked to the current scope.
|
||||
this.export_assertions = function() {
|
||||
for (let func in assertImpl) {
|
||||
this[func] = assertImpl[func].bind(assertImpl);
|
||||
}
|
||||
};
|
||||
this.Assert = assertImpl;
|
||||
|
||||
try {
|
||||
do_test_pending("MAIN run_test");
|
||||
run_test();
|
||||
|
Loading…
Reference in New Issue
Block a user