aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-09-09 01:08:34 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit16aaaa19a3ef4220726007d3e644ced0c9e06513 (patch)
tree6a7c2fc91bc362559b079afbb10dc247d7bcbae0 /tests
parentde48503aef098d855754ab6f85558402130188d7 (diff)
Allow referencing code in imported file (right now for function calls, allow calling a function in another file)
Diffstat (limited to 'tests')
-rw-r--r--tests/bytecode.amal17
-rw-r--r--tests/main.c6
2 files changed, 15 insertions, 8 deletions
diff --git a/tests/bytecode.amal b/tests/bytecode.amal
index ef255cd..6941bc8 100644
--- a/tests/bytecode.amal
+++ b/tests/bytecode.amal
@@ -1,8 +1,9 @@
-extern const print_extern: fn;
-extern const print_extern_num: fn(num: i32);
-
-const print = fn {
+/*
+extern const print_extern: fn() i32;
+extern const print_extern_num: fn(num: i32) i32;
+const print = fn() i32 {
+ return 0;
}
const main = fn {
@@ -21,4 +22,10 @@ const print_num = fn(num: i32) i32 {
print_extern_num(num);
print_extern_num(8080);
return num;
-} \ No newline at end of file
+}
+*/
+
+const io = @import("../std/io.amal");
+const main = fn {
+ io.print();
+}
diff --git a/tests/main.c b/tests/main.c
index b2b53cc..eec3a78 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -19,7 +19,7 @@ static int num_tests_run = 0;
}\
}while(0)
-static CHECK_RESULT int test_hash_map() {
+static CHECK_RESULT int test_hash_map(void) {
ArenaAllocator arena_allocator;
HashMapType(BufferView, int) hash_map;
int value;
@@ -132,7 +132,7 @@ static CHECK_RESULT int get_thread_count_env_var(int *thread_count) {
return 0;
}
-static int print_extern() {
+static int print_extern(void) {
printf("hello from amalgam extern func, print_extern!\n");
return 0;
}
@@ -228,7 +228,7 @@ static void test_load_error(const char *filepath, const char *expected_error) {
free(expected_data.expected_error);
}
-static void run_all_tests() {
+static void run_all_tests(void) {
test_load("tests/main.amal");
test_load("tests/utf8bom.amal");
test_load("tests/bytecode.amal");