From 29b7fa17be7ea8565e7a582f92e50e5107b8da08 Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 15 Dec 2024 20:02:44 +0100 Subject: Unify assert.js for tests judging from the symlink, I probably meant to do this but forgot to finish it --- test/js/asserts.js | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) mode change 100644 => 120000 test/js/asserts.js (limited to 'test/js/asserts.js') diff --git a/test/js/asserts.js b/test/js/asserts.js deleted file mode 100644 index 1d0cb6ca..00000000 --- a/test/js/asserts.js +++ /dev/null @@ -1,29 +0,0 @@ -function assert(x, msg) { - const mymsg = msg ? ": " + msg : ""; - if (!x) - throw new TypeError("Assertion failed" + mymsg); -} - -function assertThrows(expr, error) { - let me; - try { - eval(expr); - } catch (e) { - if (e instanceof error) - return; - me = e; - } - throw new TypeError("Assertion failed: expected " + error + ", got " + me + " for expression: " + expr); -} - -function assertEquals(a, b) { - assert(a === b, "Expected " + b + " but got " + a); -} - -function assertNotEquals(a, b) { - assert(a !== b, "Expected " + b + " to have some different value"); -} - -function assertInstanceof(a, b) { - assert(a instanceof b, a + " not an instance of " + b); -} diff --git a/test/js/asserts.js b/test/js/asserts.js new file mode 120000 index 00000000..8471bc87 --- /dev/null +++ b/test/js/asserts.js @@ -0,0 +1 @@ +../asserts.js \ No newline at end of file -- cgit