mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-12 11:25:04 +01:00
15 lines
No EOL
386 B
JavaScript
15 lines
No EOL
386 B
JavaScript
|
|
export function fail(msg, optionalMsg) {
|
|
optionalMsg = (optionalMsg === undefined ? '' : ' ' + optionalMsg);
|
|
throw new AssertionError(msg + optionalMsg);
|
|
}
|
|
|
|
export function assertEquals(expected, actual, msg) {
|
|
if (expected !== actual) {
|
|
fail('assertEquals: Expected: ' + expected + ' but was ' + actual, msg);
|
|
}
|
|
}
|
|
|
|
export function AssertionError(msg) {
|
|
this.msg = msg;
|
|
} |