From e3d9ee2c6224cd30bf56e24f7988899e0e3985c1 Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 21 Apr 2024 21:26:27 +0200 Subject: test: add js & layout tests (Sadly some layout tests still fail.) --- test/js/asserts.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/js/asserts.js (limited to 'test/js/asserts.js') diff --git a/test/js/asserts.js b/test/js/asserts.js new file mode 100644 index 00000000..4d8fd62c --- /dev/null +++ b/test/js/asserts.js @@ -0,0 +1,19 @@ +function assert(x, msg) { + const mymsg = msg ? ": " + msg : ""; + if (!x) + throw new TypeError("Assertion failed" + mymsg); +} + +function assert_throws(expr, error) { + try { + eval(expr); + } catch (e) { + if (e instanceof error) + return; + } + throw new TypeError("Assertion failed"); +} + +function assert_equals(a, b) { + assert(a === b, "Expected " + b + " but got " + a); +} -- cgit 1.4.1-2-gfad0