aboutsummaryrefslogtreecommitdiffstats
path: root/test/js/asserts.js
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-15 20:02:44 +0100
committerbptato <nincsnevem662@gmail.com>2024-12-15 20:07:29 +0100
commit29b7fa17be7ea8565e7a582f92e50e5107b8da08 (patch)
tree1a1515dfa73324806bc52650806457873c98893e /test/js/asserts.js
parent167f8f764974bfabbbf68a013218c90c9cdfac0b (diff)
downloadchawan-29b7fa17be7ea8565e7a582f92e50e5107b8da08.tar.gz
Unify assert.js for tests
judging from the symlink, I probably meant to do this but forgot to finish it
Diffstat (limited to 'test/js/asserts.js')
l---------[-rw-r--r--]test/js/asserts.js30
1 files changed, 1 insertions, 29 deletions
diff --git a/test/js/asserts.js b/test/js/asserts.js
index 1d0cb6ca..8471bc87 100644..120000
--- a/test/js/asserts.js
+++ b/test/js/asserts.js
@@ -1,29 +1 @@
-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);
-}
+../asserts.js \ No newline at end of file