
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.
23 lines
279 B
JavaScript
23 lines
279 B
JavaScript
load("test-common.js");
|
|
|
|
try {
|
|
|
|
let i = 1;
|
|
{
|
|
let i = 3;
|
|
assert(i === 3);
|
|
}
|
|
|
|
assert(i === 1);
|
|
|
|
{
|
|
const i = 2;
|
|
assert(i === 2);
|
|
}
|
|
|
|
assert(i === 1);
|
|
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
}
|