aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-08-17 02:57:08 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit81c5f8e750fcda6a2451fb54604130431434f88f (patch)
tree944fa06c781d57b1db90e9153080f411a1c34a55 /tests
parent20662a1d203ffb9e05d6694347fd258115b41d0a (diff)
Implement more instructions, implement function parameters and arguments
Diffstat (limited to 'tests')
-rw-r--r--tests/bytecode.amal6
-rw-r--r--tests/errors/closure_duplicate_param_name.amal1
-rw-r--r--tests/main.c1
3 files changed, 8 insertions, 0 deletions
diff --git a/tests/bytecode.amal b/tests/bytecode.amal
index 799733b..dd9bd3d 100644
--- a/tests/bytecode.amal
+++ b/tests/bytecode.amal
@@ -7,8 +7,14 @@ const main = fn {
const value3 = 2 + 5 - 1 * 10 / 2;
const str_value = "hello, world";
//printf();
+ print();
+ const result = print_num(value3);
}
const print = fn {
+}
+
+const print_num = fn(num: i32) i32 {
+ return num;
} \ No newline at end of file
diff --git a/tests/errors/closure_duplicate_param_name.amal b/tests/errors/closure_duplicate_param_name.amal
new file mode 100644
index 0000000..4e74eec
--- /dev/null
+++ b/tests/errors/closure_duplicate_param_name.amal
@@ -0,0 +1 @@
+const func = fn(value: i32, value: i32) {} \ No newline at end of file
diff --git a/tests/main.c b/tests/main.c
index 63f72d5..3336c46 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -251,6 +251,7 @@ static void run_all_tests() {
" extern const a;\n"
" ^\n");
test_load_error("tests/errors/no_main_func.amal", NULL);
+ test_load_error("tests/errors/closure_duplicate_param_name.amal", "TODO: Add expected error here");
}
/* TODO: Restrict variables in global scope to const */