
The addition of assert functions to Userland/js was done before we had load(..) implemented. Now that it exists, it seems like the right move the test helper functions to pure javascript instead of poluting js with random global functions.
20 lines
400 B
JavaScript
20 lines
400 B
JavaScript
load("test-common.js");
|
|
|
|
try {
|
|
var o = {};
|
|
o.a = 1;
|
|
|
|
assert(o.a === 1);
|
|
assert(!o.a === false);
|
|
assert(!o.a === !(o.a));
|
|
assert(~o.a === ~(o.a));
|
|
assert(+o.a === +(o.a));
|
|
assert(-o.a === -(o.a));
|
|
|
|
assert((typeof "x" === "string") === true);
|
|
assert(!(typeof "x" === "string") === false);
|
|
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
}
|