mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 16:24:59 +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.
16 lines
403 B
JavaScript
16 lines
403 B
JavaScript
|
|
function AssertionError(message) {
|
|
var instance = new Error(message);
|
|
instance.name = 'AssertionError';
|
|
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
|
|
return instance;
|
|
}
|
|
|
|
function assert(value) {
|
|
if (!value)
|
|
throw new AssertionError("The assertion failed!");
|
|
}
|
|
|
|
function assertNotReached() {
|
|
throw new AssertionError("assertNotReached() was reached!");
|
|
}
|