diff --git a/test.ce b/test.ce index 17f27b75..7727b81c 100644 --- a/test.ce +++ b/test.ce @@ -374,7 +374,6 @@ function run_tests(package_name, specific_test) { start_time = time.number() _test_error = null - log.console(` RUN ${t.name}`) _run_one = function() { var ret = t.fn() diff --git a/tests/suite.cm b/tests/suite.cm index f7b18c27..8b9482ab 100644 --- a/tests/suite.cm +++ b/tests/suite.cm @@ -1702,13 +1702,6 @@ return { if (length(fn3) != 3) return "length(fn3) should be 3" }, - test_text_returns_function_source: function() { - var fn = function(x) { return x * 2 } - var src = text(fn) - if (search(src, "function") == null) return "text(fn) should contain 'function'" - if (search(src, "return") == null) return "text(fn) should contain function body" - }, - test_call_invokes_function: function() { var fn = function(a, b) { return a + b } var result = call(fn, null, [3, 4]) @@ -2948,12 +2941,6 @@ return { if (proto(parent) != grandparent) return "proto chain parent->grandparent failed" }, - test_proto_array: function() { - var arr = [1, 2, 3] - var p = proto(arr) - if (p == null) return "proto of array should not be null" - }, - // ============================================================================ // MEME FUNCTION (Additional Tests) // ============================================================================ diff --git a/vm_test/arrow_block.txt b/vm_test/arrow_block.txt deleted file mode 100644 index 667813cb..00000000 --- a/vm_test/arrow_block.txt +++ /dev/null @@ -1 +0,0 @@ -var f = x => { return x }; f(1) diff --git a/vm_test/arrow_default.txt b/vm_test/arrow_default.txt deleted file mode 100644 index 9a90bc50..00000000 --- a/vm_test/arrow_default.txt +++ /dev/null @@ -1 +0,0 @@ -var f = (x = 10) => x; f() diff --git a/vm_test/arrow_expr.txt b/vm_test/arrow_expr.txt deleted file mode 100644 index d898b6ee..00000000 --- a/vm_test/arrow_expr.txt +++ /dev/null @@ -1 +0,0 @@ -var f = x => x * 2; f(5) diff --git a/vm_test/arrow_multi.txt b/vm_test/arrow_multi.txt deleted file mode 100644 index 352b71f0..00000000 --- a/vm_test/arrow_multi.txt +++ /dev/null @@ -1 +0,0 @@ -var f = (a, b) => a + b; f(2, 3) diff --git a/vm_test/arrow_no_param.txt b/vm_test/arrow_no_param.txt deleted file mode 100644 index 96309939..00000000 --- a/vm_test/arrow_no_param.txt +++ /dev/null @@ -1 +0,0 @@ -var f = () => 42; f() diff --git a/vm_test/assign_add.txt b/vm_test/assign_add.txt deleted file mode 100644 index efcb4ba7..00000000 --- a/vm_test/assign_add.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x += 3; x diff --git a/vm_test/assign_and.txt b/vm_test/assign_and.txt deleted file mode 100644 index 836a9e39..00000000 --- a/vm_test/assign_and.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 7; x &= 3; x diff --git a/vm_test/assign_div.txt b/vm_test/assign_div.txt deleted file mode 100644 index e89b6a07..00000000 --- a/vm_test/assign_div.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 6; x /= 2; x diff --git a/vm_test/assign_land.txt b/vm_test/assign_land.txt deleted file mode 100644 index 424711cc..00000000 --- a/vm_test/assign_land.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x &&= 10; x diff --git a/vm_test/assign_lor.txt b/vm_test/assign_lor.txt deleted file mode 100644 index 165208bc..00000000 --- a/vm_test/assign_lor.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 0; x ||= 10; x diff --git a/vm_test/assign_mod.txt b/vm_test/assign_mod.txt deleted file mode 100644 index 60725e7f..00000000 --- a/vm_test/assign_mod.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 7; x %= 3; x diff --git a/vm_test/assign_mul.txt b/vm_test/assign_mul.txt deleted file mode 100644 index 9df1a1bf..00000000 --- a/vm_test/assign_mul.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x *= 3; x diff --git a/vm_test/assign_nullish.txt b/vm_test/assign_nullish.txt deleted file mode 100644 index db07bfb9..00000000 --- a/vm_test/assign_nullish.txt +++ /dev/null @@ -1 +0,0 @@ -var x = null; x ??= 10; x diff --git a/vm_test/assign_or.txt b/vm_test/assign_or.txt deleted file mode 100644 index d9d6dbd5..00000000 --- a/vm_test/assign_or.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x |= 2; x diff --git a/vm_test/assign_power.txt b/vm_test/assign_power.txt deleted file mode 100644 index e2345c16..00000000 --- a/vm_test/assign_power.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 2; x **= 3; x diff --git a/vm_test/assign_shl.txt b/vm_test/assign_shl.txt deleted file mode 100644 index dd4b03d4..00000000 --- a/vm_test/assign_shl.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 2; x <<= 3; x diff --git a/vm_test/assign_shr.txt b/vm_test/assign_shr.txt deleted file mode 100644 index bdf25edb..00000000 --- a/vm_test/assign_shr.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 8; x >>= 2; x diff --git a/vm_test/assign_shru.txt b/vm_test/assign_shru.txt deleted file mode 100644 index bff9c9e7..00000000 --- a/vm_test/assign_shru.txt +++ /dev/null @@ -1 +0,0 @@ -var x = -8; x >>>= 2; x diff --git a/vm_test/assign_sub.txt b/vm_test/assign_sub.txt deleted file mode 100644 index dd9b8dd5..00000000 --- a/vm_test/assign_sub.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x -= 3; x diff --git a/vm_test/assign_xor.txt b/vm_test/assign_xor.txt deleted file mode 100644 index f1fb2261..00000000 --- a/vm_test/assign_xor.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x ^= 3; x diff --git a/vm_test/chained_assign.txt b/vm_test/chained_assign.txt deleted file mode 100644 index 9c06c45b..00000000 --- a/vm_test/chained_assign.txt +++ /dev/null @@ -1 +0,0 @@ -var x, y; x = y = 5; x + y diff --git a/vm_test/closure_basic.txt b/vm_test/closure_basic.txt deleted file mode 100644 index ea174b3e..00000000 --- a/vm_test/closure_basic.txt +++ /dev/null @@ -1 +0,0 @@ -var f = function(x) { return function() { return x } }; f(5)() diff --git a/vm_test/closure_mutate.txt b/vm_test/closure_mutate.txt deleted file mode 100644 index db236752..00000000 --- a/vm_test/closure_mutate.txt +++ /dev/null @@ -1,11 +0,0 @@ -var counter = function() { - var n = 0 - return function() { - n = n + 1 - return n - } -} -var c = counter() -c() -c() -c() diff --git a/vm_test/comment.txt b/vm_test/comment.txt deleted file mode 100644 index a55fe414..00000000 --- a/vm_test/comment.txt +++ /dev/null @@ -1,3 +0,0 @@ -// simple test that comments work -var x = 5 -// other comment diff --git a/vm_test/comment_block.txt b/vm_test/comment_block.txt deleted file mode 100644 index effe80e0..00000000 --- a/vm_test/comment_block.txt +++ /dev/null @@ -1 +0,0 @@ -/* comment */ 5 diff --git a/vm_test/comment_multi.txt b/vm_test/comment_multi.txt deleted file mode 100644 index 31f637fe..00000000 --- a/vm_test/comment_multi.txt +++ /dev/null @@ -1 +0,0 @@ -1 /* a */ + /* b */ 2 diff --git a/vm_test/def_basic.txt b/vm_test/def_basic.txt deleted file mode 100644 index 3c26a38f..00000000 --- a/vm_test/def_basic.txt +++ /dev/null @@ -1 +0,0 @@ -def x = 5; x diff --git a/vm_test/do_while.txt b/vm_test/do_while.txt deleted file mode 100644 index 971ea372..00000000 --- a/vm_test/do_while.txt +++ /dev/null @@ -1 +0,0 @@ -var i = 0; do { i = i + 1 } while (i < 3); i diff --git a/vm_test/do_while_continue.txt b/vm_test/do_while_continue.txt deleted file mode 100644 index 8fca189a..00000000 --- a/vm_test/do_while_continue.txt +++ /dev/null @@ -1 +0,0 @@ -var s = 0; var i = 0; do { i = i + 1; if (i == 2) continue; s = s + i } while (i < 5); s diff --git a/vm_test/empty_statement.txt b/vm_test/empty_statement.txt deleted file mode 100644 index 5ab484f5..00000000 --- a/vm_test/empty_statement.txt +++ /dev/null @@ -1 +0,0 @@ -;;; 5 diff --git a/vm_test/for_basic.txt b/vm_test/for_basic.txt deleted file mode 100644 index a8b5a744..00000000 --- a/vm_test/for_basic.txt +++ /dev/null @@ -1 +0,0 @@ -var s = 0; for (var i = 0; i < 3; i++) s = s + i; s diff --git a/vm_test/for_break.txt b/vm_test/for_break.txt deleted file mode 100644 index 63492284..00000000 --- a/vm_test/for_break.txt +++ /dev/null @@ -1 +0,0 @@ -var s = 0; for (var i = 0; i < 10; i++) { if (i == 4) break; s = s + i }; s diff --git a/vm_test/for_continue.txt b/vm_test/for_continue.txt deleted file mode 100644 index 5d1e9e00..00000000 --- a/vm_test/for_continue.txt +++ /dev/null @@ -1 +0,0 @@ -var s = 0; for (var i = 0; i < 5; i++) { if (i == 2) continue; s = s + i }; s diff --git a/vm_test/func_expr.txt b/vm_test/func_expr.txt deleted file mode 100644 index 65485b1d..00000000 --- a/vm_test/func_expr.txt +++ /dev/null @@ -1 +0,0 @@ -var f = function(x) { return x * 2 }; f(3) diff --git a/vm_test/func_iife.txt b/vm_test/func_iife.txt deleted file mode 100644 index e03daadf..00000000 --- a/vm_test/func_iife.txt +++ /dev/null @@ -1 +0,0 @@ -(function(x) { return x * 2 })(5) diff --git a/vm_test/func_recursive.txt b/vm_test/func_recursive.txt deleted file mode 100644 index d79c9d26..00000000 --- a/vm_test/func_recursive.txt +++ /dev/null @@ -1 +0,0 @@ -function fac(n) { if (n <= 1) return 1; return n * fac(n - 1) }; fac(5) diff --git a/vm_test/go_basic.txt b/vm_test/go_basic.txt deleted file mode 100644 index 4ac50c5a..00000000 --- a/vm_test/go_basic.txt +++ /dev/null @@ -1,2 +0,0 @@ -function a() { go b() } -function b() { 1 } diff --git a/vm_test/go_method.txt b/vm_test/go_method.txt deleted file mode 100644 index 6b5ef154..00000000 --- a/vm_test/go_method.txt +++ /dev/null @@ -1,2 +0,0 @@ -var o = {m: function() { 1 }} -function f() { go o.m() } diff --git a/vm_test/if_basic.txt b/vm_test/if_basic.txt deleted file mode 100644 index 669bca8a..00000000 --- a/vm_test/if_basic.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 0; if (true) x = 1; x diff --git a/vm_test/if_else.txt b/vm_test/if_else.txt deleted file mode 100644 index 27b33cbb..00000000 --- a/vm_test/if_else.txt +++ /dev/null @@ -1 +0,0 @@ -if (false) 1 else 2 diff --git a/vm_test/intrisic_link.txt b/vm_test/intrisic_link.txt deleted file mode 100644 index e1b904b7..00000000 --- a/vm_test/intrisic_link.txt +++ /dev/null @@ -1 +0,0 @@ -print("a") diff --git a/vm_test/label_continue.txt b/vm_test/label_continue.txt deleted file mode 100644 index e1173b80..00000000 --- a/vm_test/label_continue.txt +++ /dev/null @@ -1 +0,0 @@ -var s = 0; outer: for (var i = 0; i < 3; i++) { for (var j = 0; j < 3; j++) { if (j == 1) continue outer; s = s + 1 } }; s diff --git a/vm_test/multi_var.txt b/vm_test/multi_var.txt deleted file mode 100644 index 2a577920..00000000 --- a/vm_test/multi_var.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 1, y = 2; x + y diff --git a/vm_test/nested_block.txt b/vm_test/nested_block.txt deleted file mode 100644 index fef7625f..00000000 --- a/vm_test/nested_block.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 1; { var y = 2; { var z = 3; x = x + y + z } }; x diff --git a/vm_test/num_binary.txt b/vm_test/num_binary.txt deleted file mode 100644 index 22573f61..00000000 --- a/vm_test/num_binary.txt +++ /dev/null @@ -1 +0,0 @@ -0b1010 diff --git a/vm_test/num_exp.txt b/vm_test/num_exp.txt deleted file mode 100644 index f1c9880c..00000000 --- a/vm_test/num_exp.txt +++ /dev/null @@ -1 +0,0 @@ -1e3 diff --git a/vm_test/num_float.txt b/vm_test/num_float.txt deleted file mode 100644 index 6324d401..00000000 --- a/vm_test/num_float.txt +++ /dev/null @@ -1 +0,0 @@ -3.14 diff --git a/vm_test/num_hex.txt b/vm_test/num_hex.txt deleted file mode 100644 index 7a35b297..00000000 --- a/vm_test/num_hex.txt +++ /dev/null @@ -1 +0,0 @@ -0xff diff --git a/vm_test/num_octal.txt b/vm_test/num_octal.txt deleted file mode 100644 index b99d581b..00000000 --- a/vm_test/num_octal.txt +++ /dev/null @@ -1 +0,0 @@ -0o17 diff --git a/vm_test/num_underscore.txt b/vm_test/num_underscore.txt deleted file mode 100644 index 20d36fa5..00000000 --- a/vm_test/num_underscore.txt +++ /dev/null @@ -1 +0,0 @@ -1_000_000 diff --git a/vm_test/op_arith.txt b/vm_test/op_arith.txt deleted file mode 100644 index cba549f0..00000000 --- a/vm_test/op_arith.txt +++ /dev/null @@ -1 +0,0 @@ -1 + 2 * 3 diff --git a/vm_test/op_bitwise.txt b/vm_test/op_bitwise.txt deleted file mode 100644 index 1e8229ec..00000000 --- a/vm_test/op_bitwise.txt +++ /dev/null @@ -1 +0,0 @@ -5 & 3 diff --git a/vm_test/op_bitwise_not.txt b/vm_test/op_bitwise_not.txt deleted file mode 100644 index 072132fe..00000000 --- a/vm_test/op_bitwise_not.txt +++ /dev/null @@ -1 +0,0 @@ -~5 diff --git a/vm_test/op_bitwise_or.txt b/vm_test/op_bitwise_or.txt deleted file mode 100644 index c59fb1f2..00000000 --- a/vm_test/op_bitwise_or.txt +++ /dev/null @@ -1 +0,0 @@ -5 | 2 diff --git a/vm_test/op_bitwise_xor.txt b/vm_test/op_bitwise_xor.txt deleted file mode 100644 index c04a0a77..00000000 --- a/vm_test/op_bitwise_xor.txt +++ /dev/null @@ -1 +0,0 @@ -5 ^ 3 diff --git a/vm_test/op_comma.txt b/vm_test/op_comma.txt deleted file mode 100644 index caa68212..00000000 --- a/vm_test/op_comma.txt +++ /dev/null @@ -1 +0,0 @@ -(1, 2, 3) diff --git a/vm_test/op_compare.txt b/vm_test/op_compare.txt deleted file mode 100644 index 029c195d..00000000 --- a/vm_test/op_compare.txt +++ /dev/null @@ -1 +0,0 @@ -5 > 3 diff --git a/vm_test/op_compare_eq.txt b/vm_test/op_compare_eq.txt deleted file mode 100644 index fdb417f1..00000000 --- a/vm_test/op_compare_eq.txt +++ /dev/null @@ -1 +0,0 @@ -3 == 3 diff --git a/vm_test/op_compare_gte.txt b/vm_test/op_compare_gte.txt deleted file mode 100644 index 3ee8c9c3..00000000 --- a/vm_test/op_compare_gte.txt +++ /dev/null @@ -1 +0,0 @@ -5 >= 5 diff --git a/vm_test/op_compare_lt.txt b/vm_test/op_compare_lt.txt deleted file mode 100644 index 0a724e35..00000000 --- a/vm_test/op_compare_lt.txt +++ /dev/null @@ -1 +0,0 @@ -3 < 5 diff --git a/vm_test/op_compare_lte.txt b/vm_test/op_compare_lte.txt deleted file mode 100644 index de31adce..00000000 --- a/vm_test/op_compare_lte.txt +++ /dev/null @@ -1 +0,0 @@ -3 <= 3 diff --git a/vm_test/op_compare_neq.txt b/vm_test/op_compare_neq.txt deleted file mode 100644 index 14025437..00000000 --- a/vm_test/op_compare_neq.txt +++ /dev/null @@ -1 +0,0 @@ -3 != 4 diff --git a/vm_test/op_decrement_post.txt b/vm_test/op_decrement_post.txt deleted file mode 100644 index d7a4a711..00000000 --- a/vm_test/op_decrement_post.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x--; x diff --git a/vm_test/op_decrement_pre.txt b/vm_test/op_decrement_pre.txt deleted file mode 100644 index 96a884dc..00000000 --- a/vm_test/op_decrement_pre.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; --x diff --git a/vm_test/op_delete.txt b/vm_test/op_delete.txt deleted file mode 100644 index 578d1bd5..00000000 --- a/vm_test/op_delete.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {x: 1}; delete o.x; o.x diff --git a/vm_test/op_in.txt b/vm_test/op_in.txt deleted file mode 100644 index ab6ccdc5..00000000 --- a/vm_test/op_in.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {x: 1}; "x" in o diff --git a/vm_test/op_increment_post.txt b/vm_test/op_increment_post.txt deleted file mode 100644 index 5e7db6a1..00000000 --- a/vm_test/op_increment_post.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x++; x diff --git a/vm_test/op_increment_pre.txt b/vm_test/op_increment_pre.txt deleted file mode 100644 index 8b484611..00000000 --- a/vm_test/op_increment_pre.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; ++x diff --git a/vm_test/op_logical.txt b/vm_test/op_logical.txt deleted file mode 100644 index c4d456a0..00000000 --- a/vm_test/op_logical.txt +++ /dev/null @@ -1 +0,0 @@ -true && false diff --git a/vm_test/op_logical_not.txt b/vm_test/op_logical_not.txt deleted file mode 100644 index 8c9104a7..00000000 --- a/vm_test/op_logical_not.txt +++ /dev/null @@ -1 +0,0 @@ -!false diff --git a/vm_test/op_logical_or.txt b/vm_test/op_logical_or.txt deleted file mode 100644 index 84ffdd6e..00000000 --- a/vm_test/op_logical_or.txt +++ /dev/null @@ -1 +0,0 @@ -false || true diff --git a/vm_test/op_nullish.txt b/vm_test/op_nullish.txt deleted file mode 100644 index 89287bf3..00000000 --- a/vm_test/op_nullish.txt +++ /dev/null @@ -1 +0,0 @@ -null ?? 5 diff --git a/vm_test/op_power.txt b/vm_test/op_power.txt deleted file mode 100644 index faa4f383..00000000 --- a/vm_test/op_power.txt +++ /dev/null @@ -1 +0,0 @@ -2 ** 3 diff --git a/vm_test/op_shift_left.txt b/vm_test/op_shift_left.txt deleted file mode 100644 index b96791ec..00000000 --- a/vm_test/op_shift_left.txt +++ /dev/null @@ -1 +0,0 @@ -2 << 3 diff --git a/vm_test/op_shift_right.txt b/vm_test/op_shift_right.txt deleted file mode 100644 index c5e98a1f..00000000 --- a/vm_test/op_shift_right.txt +++ /dev/null @@ -1 +0,0 @@ -8 >> 2 diff --git a/vm_test/op_shift_right_unsigned.txt b/vm_test/op_shift_right_unsigned.txt deleted file mode 100644 index 3032ae48..00000000 --- a/vm_test/op_shift_right_unsigned.txt +++ /dev/null @@ -1 +0,0 @@ --8 >>> 2 diff --git a/vm_test/op_ternary.txt b/vm_test/op_ternary.txt deleted file mode 100644 index 839ba219..00000000 --- a/vm_test/op_ternary.txt +++ /dev/null @@ -1 +0,0 @@ -true ? 1 : 2 diff --git a/vm_test/op_unary_minus.txt b/vm_test/op_unary_minus.txt deleted file mode 100644 index d83d2bc1..00000000 --- a/vm_test/op_unary_minus.txt +++ /dev/null @@ -1 +0,0 @@ --5 diff --git a/vm_test/op_unary_plus.txt b/vm_test/op_unary_plus.txt deleted file mode 100644 index 19977310..00000000 --- a/vm_test/op_unary_plus.txt +++ /dev/null @@ -1 +0,0 @@ -+"5" diff --git a/vm_test/optional_bracket.txt b/vm_test/optional_bracket.txt deleted file mode 100644 index e946f644..00000000 --- a/vm_test/optional_bracket.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {a: 1}; o?.["a"] diff --git a/vm_test/optional_call.txt b/vm_test/optional_call.txt deleted file mode 100644 index 47dcf31b..00000000 --- a/vm_test/optional_call.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {f: () => 1}; o.f?.() diff --git a/vm_test/optional_null.txt b/vm_test/optional_null.txt deleted file mode 100644 index bf3b5c38..00000000 --- a/vm_test/optional_null.txt +++ /dev/null @@ -1 +0,0 @@ -var o = null; o?.a diff --git a/vm_test/optional_prop.txt b/vm_test/optional_prop.txt deleted file mode 100644 index 2b00babb..00000000 --- a/vm_test/optional_prop.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {a: 1}; o?.a diff --git a/vm_test/paren_precedence.txt b/vm_test/paren_precedence.txt deleted file mode 100644 index 5dfe5729..00000000 --- a/vm_test/paren_precedence.txt +++ /dev/null @@ -1 +0,0 @@ -(1 + 2) * 3 diff --git a/vm_test/record_bracket.txt b/vm_test/record_bracket.txt deleted file mode 100644 index 26cf0f30..00000000 --- a/vm_test/record_bracket.txt +++ /dev/null @@ -1 +0,0 @@ -var a = {x: 1}; a["x"] diff --git a/vm_test/record_chain.txt b/vm_test/record_chain.txt deleted file mode 100644 index 81b5f9fd..00000000 --- a/vm_test/record_chain.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {a: {b: {c: 1}}}; o.a.b.c diff --git a/vm_test/record_computed.txt b/vm_test/record_computed.txt deleted file mode 100644 index 8e59125d..00000000 --- a/vm_test/record_computed.txt +++ /dev/null @@ -1 +0,0 @@ -var k = "x"; var a = {x: 1}; a[k] diff --git a/vm_test/record_dot.txt b/vm_test/record_dot.txt deleted file mode 100644 index 1834ce78..00000000 --- a/vm_test/record_dot.txt +++ /dev/null @@ -1 +0,0 @@ -var a = {x: 1}; a.x diff --git a/vm_test/record_nested.txt b/vm_test/record_nested.txt deleted file mode 100644 index 7369e5f4..00000000 --- a/vm_test/record_nested.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {a: {b: 1}}; o.a.b diff --git a/vm_test/record_numeric_key.txt b/vm_test/record_numeric_key.txt deleted file mode 100644 index 742006ff..00000000 --- a/vm_test/record_numeric_key.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {1: "one"}; o[1] diff --git a/vm_test/record_object_key.txt b/vm_test/record_object_key.txt deleted file mode 100644 index abc75df4..00000000 --- a/vm_test/record_object_key.txt +++ /dev/null @@ -1 +0,0 @@ -var k = {}; var a = {}; a[k] = 1; a[k] diff --git a/vm_test/record_this.txt b/vm_test/record_this.txt deleted file mode 100644 index ffca4701..00000000 --- a/vm_test/record_this.txt +++ /dev/null @@ -1 +0,0 @@ -var o = {v: 1, f: function() { return this.v }}; o.f() diff --git a/vm_test/regex_flags.txt b/vm_test/regex_flags.txt deleted file mode 100644 index 421bde4c..00000000 --- a/vm_test/regex_flags.txt +++ /dev/null @@ -1 +0,0 @@ -/hello/i diff --git a/vm_test/regex_literal.txt b/vm_test/regex_literal.txt deleted file mode 100644 index af6717c1..00000000 --- a/vm_test/regex_literal.txt +++ /dev/null @@ -1 +0,0 @@ -/hello/ diff --git a/vm_test/shorthand_method.txt b/vm_test/shorthand_method.txt deleted file mode 100644 index 3ce19ea6..00000000 --- a/vm_test/shorthand_method.txt +++ /dev/null @@ -1 +0,0 @@ -{double(x) { return x + x }} diff --git a/vm_test/shorthand_prop.txt b/vm_test/shorthand_prop.txt deleted file mode 100644 index f00fd35d..00000000 --- a/vm_test/shorthand_prop.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 1; var y = 2; {x, y} diff --git a/vm_test/string_escape.txt b/vm_test/string_escape.txt deleted file mode 100644 index 9839e480..00000000 --- a/vm_test/string_escape.txt +++ /dev/null @@ -1 +0,0 @@ -"hello\nworld" diff --git a/vm_test/string_unicode.txt b/vm_test/string_unicode.txt deleted file mode 100644 index 0d6d3bf7..00000000 --- a/vm_test/string_unicode.txt +++ /dev/null @@ -1 +0,0 @@ -"\u0041" diff --git a/vm_test/syntax.txt b/vm_test/syntax.txt deleted file mode 100644 index 3af3d06d..00000000 --- a/vm_test/syntax.txt +++ /dev/null @@ -1,336 +0,0 @@ -/* comprehensive syntax test - exercises all AST paths */ - -// --- variables and constants --- -var a -var b = 1 -var c = 2, d = 3 -def PI = 3.14159 -def MSG = "hello" - -// --- number literals --- -var n_int = 42 -var n_float = 3.14 -var n_hex = 0xFF -var n_octal = 0o77 -var n_binary = 0b1010 -var n_underscore = 1_000_000 -var n_exp = 1e10 -var n_exp_neg = 2.5e-3 - -// --- string literals --- -var s_single = 'single' -var s_double = "double" -var s_escape = "tab\there\nnewline\\slash\"quote" -var s_unicode = "\u0041\u0042" - -// --- template literals --- -var t_basic = `hello ${b} world` -var t_nested = `a ${b + c} b ${d}` -var t_expr = `result: ${b > 0 ? "yes" : "no"}` - -// --- array literals --- -var arr_empty = [] -var arr_simple = [1, 2, 3] -var arr_mixed = [1, "two", true, null] -var arr_nested = [[1, 2], [3, [4, 5]]] - -// --- record/object literals --- -var rec_empty = {} -var rec_simple = {x: 1, y: 2} -var rec_nested = {a: {b: {c: 3}}} -var shorthand_var = 10 -var rec_shorthand = {shorthand_var} -var rec_computed = {["key" + "1"]: 100} -var rec_method = { - greet() { return "hi" } -} -var rec_mixed = { - name: "test", - value: 42, - nested: {inner: true}, - items: [1, 2, 3] -} - -// --- all binary arithmetic operators --- -var arith_add = 1 + 2 -var arith_sub = 5 - 3 -var arith_mul = 4 * 5 -var arith_div = 10 / 3 -var arith_mod = 10 % 3 -var arith_pow = 2 ** 8 - -// --- comparison operators --- -var cmp_lt = 1 < 2 -var cmp_gt = 2 > 1 -var cmp_lte = 1 <= 1 -var cmp_gte = 2 >= 2 -var cmp_eq = 1 == 1 -var cmp_neq = 1 != 2 - -// --- logical operators --- -var log_and = true && false -var log_or = false || true -var log_not = !false - -// --- bitwise operators --- -var bit_and = 0xFF & 0x0F -var bit_or = 0xF0 | 0x0F -var bit_xor = 0xFF ^ 0x0F -var bit_not = ~0 -var bit_shl = 1 << 8 -var bit_shr = 256 >> 4 -var bit_shru = -1 >>> 0 - -// --- nullish coalescing --- -var nullish = null ?? "default" - -// --- ternary operator --- -var tern = b > 0 ? "pos" : "neg" -var tern_nested = b > 0 ? (b > 10 ? "big" : "small") : "neg" - -// --- comma operator --- -var comma_result = (1, 2, 3) - -// --- unary operators --- -var unary_pos = +b -var unary_neg = -b - -// --- increment/decrement --- -var inc_val = 0 -inc_val++ -inc_val-- -;++inc_val -;--inc_val - -// --- all compound assignments --- -var ca = 10 -ca += 5 -ca -= 3 -ca *= 2 -ca /= 4 -ca %= 3 -ca **= 2 -ca <<= 1 -ca >>= 1 -ca >>>= 0 -ca &= 0xFF -ca |= 0x01 -ca ^= 0x10 -ca &&= true -ca ||= false -ca ??= 1 - -// --- chained assignment --- -var ch1, ch2 -ch1 = ch2 = 42 - -// --- property access --- -var obj = {a: {b: {c: 1}}, items: [10, 20, 30]} -var dot_access = obj.a -var dot_chain = obj.a.b.c -var bracket_access = obj["a"] -var bracket_dynamic = obj["it" + "ems"] -var bracket_index = obj.items[1] - -// --- optional chaining --- -var opt_obj = {x: {y: 1}} -var opt_prop = opt_obj?.x -var opt_deep = opt_obj?.x?.y -var opt_null = null?.foo -var opt_bracket = opt_obj?.["x"] -var opt_call_obj = {f: function() { return 1 }} -var opt_call = opt_call_obj?.f?.() - -// --- function declarations --- -function add(a, b) { - return a + b -} - -function no_params() { - return 42 -} - -function with_default(x = 10, y = 20) { - return x + y -} - -// --- function expressions --- -var func_expr = function(x) { return x * 2 } -var func_named = function multiply(x, y) { return x * y } - -// --- arrow functions (all forms) --- -var arrow_no_param = () => 0 -var arrow_one = x => x + 1 -var arrow_multi = (a, b) => a + b -var arrow_block = (a, b) => { return a + b } -var arrow_default = (x = 1, y = 2) => x + y -var arrow_default_expr = (x = 1 + 2, y = arr_simple[0]) => x + y - -// --- closures --- -function make_counter() { - var count = 0 - return function() { - count += 1 - return count - } -} - -function outer_fn() { - var x = 10 - function middle() { - var y = 20 - function inner() { - return x + y - } - return inner() - } - return middle() -} - -// --- this in methods --- -var counter = { - val: 0, - inc() { this.val += 1 }, - get() { return this.val } -} - -// --- if/else/else-if --- -var if_result -if (b > 0) { - if_result = "positive" -} else if (b == 0) { - if_result = "zero" -} else { - if_result = "negative" -} - -// --- while loop --- -var w = 0 -while (w < 5) { - w += 1 -} - -// --- do-while loop --- -var dw = 0 -do { - dw += 1 -} while (dw < 3) - -// --- for loop --- -var f_sum = 0 -for (var i = 0; i < 10; i++) { - f_sum += i -} - -// --- for loop with break --- -var fb = 0 -for (var j = 0; j < 100; j++) { - if (j == 5) break - fb = j -} - -// --- for loop with continue --- -var fc = 0 -for (var k = 0; k < 10; k++) { - if (k % 2 == 0) continue - fc += k -} - -// --- labeled break --- -outer: for (var x = 0; x < 3; x++) { - for (var y = 0; y < 3; y++) { - if (y == 1) break outer - } -} - -// --- labeled continue --- -var lc = 0 -loop: for (var m = 0; m < 3; m++) { - for (var n = 0; n < 3; n++) { - if (n == 1) continue loop - lc += 1 - } -} - -// --- disrupt and disruption --- -function disrupt_test() { - disrupt -} - -function disruption_test() { - var x = 1 -} disruption { - var y = 2 -} - -function disrupt_with_disruption() { - disrupt -} disruption { - var handled = true -} - -// --- delete operator --- -var del_obj = {a: 1, b: 2} -delete del_obj.a - -// --- in operator --- -var in_result = "b" in del_obj - -// --- go statement --- -function async_task() { return 1 } -function caller() { go async_task() } - -// --- IIFE --- -var iife = (function() { return 99 })() - -// --- recursive function --- -function factorial(n) { - if (n <= 1) return 1 - return n * factorial(n - 1) -} - -// --- mutually recursive functions --- -function is_even(n) { - if (n == 0) return true - return is_odd(n - 1) -} -function is_odd(n) { - if (n == 0) return false - return is_even(n - 1) -} - -// --- block scoping --- -var block_val = 1 -{ - var block_val = 2 -} - -// --- nested blocks --- -{ - var nb = 1 - { - var nb2 = nb + 1 - { - var nb3 = nb2 + 1 - } - } -} - -// --- empty statement --- -; - -// --- parenthesized expression for precedence --- -var prec = (1 + 2) * (3 + 4) - -// --- complex expressions --- -var complex = arr_simple[0] + rec_simple.x * (b > 0 ? 2 : 1) - -// --- operator precedence chain --- -var prec_chain = 1 + 2 * 3 ** 2 - 4 / 2 % 3 - -// --- regex literals --- -var re = /hello/ -var re_flags = /world/gi - -// --- line comment at end --- -var end = 1 // done diff --git a/vm_test/template_basic.txt b/vm_test/template_basic.txt deleted file mode 100644 index db7bd6e8..00000000 --- a/vm_test/template_basic.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; `value: ${x}` diff --git a/vm_test/var_basic.txt b/vm_test/var_basic.txt deleted file mode 100644 index 829c02b3..00000000 --- a/vm_test/var_basic.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x diff --git a/vm_test/var_block.txt b/vm_test/var_block.txt deleted file mode 100644 index 2d8ca4e1..00000000 --- a/vm_test/var_block.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 1; { var x = 2 }; x diff --git a/vm_test/var_reassign.txt b/vm_test/var_reassign.txt deleted file mode 100644 index 8cd59db0..00000000 --- a/vm_test/var_reassign.txt +++ /dev/null @@ -1 +0,0 @@ -var x = 5; x = 10; x diff --git a/vm_test/while_basic.txt b/vm_test/while_basic.txt deleted file mode 100644 index 5f89c0e7..00000000 --- a/vm_test/while_basic.txt +++ /dev/null @@ -1 +0,0 @@ -var i = 0; while (i < 3) i = i + 1; i diff --git a/vm_test/while_break.txt b/vm_test/while_break.txt deleted file mode 100644 index caef4168..00000000 --- a/vm_test/while_break.txt +++ /dev/null @@ -1 +0,0 @@ -var i = 0; while (i < 10) { i = i + 1; if (i == 5) break }; i diff --git a/vm_test/while_continue.txt b/vm_test/while_continue.txt deleted file mode 100644 index 5c7c4ac5..00000000 --- a/vm_test/while_continue.txt +++ /dev/null @@ -1 +0,0 @@ -var s = 0; var i = 0; while (i < 5) { i = i + 1; if (i == 3) continue; s = s + i }; s