mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 22:55:06 +00:00

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.
31 lines
726 B
JavaScript
31 lines
726 B
JavaScript
load("test-common.js");
|
|
|
|
try {
|
|
try {
|
|
Math.abs(-20) = 40;
|
|
assertNotReached();
|
|
} catch (e) {
|
|
assert(e.name === "ReferenceError");
|
|
assert(e.message === "Invalid left-hand side in assignment");
|
|
}
|
|
|
|
try {
|
|
512 = 256;
|
|
assertNotReached();
|
|
} catch (e) {
|
|
assert(e.name === "ReferenceError");
|
|
assert(e.message === "Invalid left-hand side in assignment");
|
|
}
|
|
|
|
try {
|
|
"hello world" = "another thing?";
|
|
assertNotReached();
|
|
} catch (e) {
|
|
assert(e.name === "ReferenceError");
|
|
assert(e.message === "Invalid left-hand side in assignment");
|
|
}
|
|
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
}
|