From 7212ea877ed85d3b85af90c902639df44fc493f2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 24 Aug 2019 00:48:40 +0200 Subject: Add exported variable (only functions for now), export main func, start execution from main func --- tests/bytecode.amal | 10 ++++------ tests/errors/incorrect_main.amal | 1 + tests/main.c | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 tests/errors/incorrect_main.amal (limited to 'tests') diff --git a/tests/bytecode.amal b/tests/bytecode.amal index a8ea53b..32c1ccb 100644 --- a/tests/bytecode.amal +++ b/tests/bytecode.amal @@ -1,8 +1,10 @@ -const b = @import("b.amal"); - extern const print_extern: fn; extern const print_extern_num: fn(num: i32); +const print = fn { + +} + const main = fn { var value = 23; value = 34; @@ -15,10 +17,6 @@ const main = fn { const result = print_num(1337); } -const print = fn { - -} - const print_num = fn(num: i32) i32 { print_extern(); print_extern_num(num); diff --git a/tests/errors/incorrect_main.amal b/tests/errors/incorrect_main.amal new file mode 100644 index 0000000..9d2a61f --- /dev/null +++ b/tests/errors/incorrect_main.amal @@ -0,0 +1 @@ +const main = fn(arg: i32) {} \ No newline at end of file diff --git a/tests/main.c b/tests/main.c index 3573f9c..b2b53cc 100644 --- a/tests/main.c +++ b/tests/main.c @@ -279,6 +279,7 @@ static void run_all_tests() { test_load_error("tests/errors/closure_duplicate_param_name.amal", "TODO: Add expected error here"); test_load_error("tests/errors/extern_closure_one_return_value.amal", "TODO: Add expected error here"); test_load_error("tests/errors/too_long_var_name.amal", "TODO: Add expected error here"); + test_load_error("tests/errors/incorrect_main.amal", "TODO: Add expected error here"); } /* TODO: Restrict variables in global scope to const */ -- cgit v1.2.3