diff options
Diffstat (limited to 'test/js')
l---------[-rw-r--r--] | test/js/asserts.js | 20 | ||||
-rw-r--r-- | test/js/console.html | 5 | ||||
-rwxr-xr-x | test/js/run_js_tests.sh | 6 | ||||
-rw-r--r-- | test/js/xhr.html | 17 |
4 files changed, 4 insertions, 44 deletions
diff --git a/test/js/asserts.js b/test/js/asserts.js index e84f2d71..8471bc87 100644..120000 --- a/test/js/asserts.js +++ b/test/js/asserts.js @@ -1,19 +1 @@ -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); -} +../asserts.js \ No newline at end of file diff --git a/test/js/console.html b/test/js/console.html deleted file mode 100644 index 67b244a7..00000000 --- a/test/js/console.html +++ /dev/null @@ -1,5 +0,0 @@ -<!doctype html> -<div>Success</div> -<script> -console.log("Hello, world!") -</script> diff --git a/test/js/run_js_tests.sh b/test/js/run_js_tests.sh index ac531a67..3f484449 100755 --- a/test/js/run_js_tests.sh +++ b/test/js/run_js_tests.sh @@ -1,11 +1,11 @@ #!/bin/sh -if ! test "$CHA_TEST_BIN" -then test -f ../../cha && CHA_TEST_BIN=../../cha || CHA_TEST_BIN=cha +if ! test "$CHA" +then test -f ../../cha && CHA=../../cha || CHA=cha fi failed=0 for h in *.html do printf '%s\r' "$h" - if ! "$CHA_TEST_BIN" -C config.toml "$h" | diff all.expected - + if ! "$CHA" -dC config.toml "$h" | diff all.expected - then failed=$(($failed+1)) printf 'FAIL: %s\n' "$h" fi diff --git a/test/js/xhr.html b/test/js/xhr.html deleted file mode 100644 index 4bd66b95..00000000 --- a/test/js/xhr.html +++ /dev/null @@ -1,17 +0,0 @@ -<!doctype html> -<title>onclick setter/getter</title> -<div id=x>Fail</div> -<script src=asserts.js></script> -<script> -const x = new XMLHttpRequest(); -assert(x.onreadystatechange === null); -function myFunction() { - console.log("change"); -} -x.onreadystatechange = myFunction; -assert(myFunction === x.onreadystatechange); -assert(x.readyState === XMLHttpRequest.UNSENT); -x.open("GET", ""); -document.getElementById("x").textContent = "Success"; -x.send(); -</script> |