aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-08-24 00:48:40 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit7212ea877ed85d3b85af90c902639df44fc493f2 (patch)
treec76d73e9882a832f82cef977efb6fb26fb0e4984 /tests
parentd6f368a3f400fea3e89280262a8147e7ce5d855c (diff)
Add exported variable (only functions for now), export main func, start execution from main func
Diffstat (limited to 'tests')
-rw-r--r--tests/bytecode.amal10
-rw-r--r--tests/errors/incorrect_main.amal1
-rw-r--r--tests/main.c1
3 files changed, 6 insertions, 6 deletions
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 */