From 81c5f8e750fcda6a2451fb54604130431434f88f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 17 Aug 2019 02:57:08 +0200 Subject: Implement more instructions, implement function parameters and arguments --- tests/bytecode.amal | 6 ++++++ tests/errors/closure_duplicate_param_name.amal | 1 + tests/main.c | 1 + 3 files changed, 8 insertions(+) create mode 100644 tests/errors/closure_duplicate_param_name.amal (limited to 'tests') 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 */ -- cgit v1.2.3