From 2323ca6c9ec3c8ee76b9acf13745b80b92952a6a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 18 Mar 2019 23:47:45 +0100 Subject: Add struct, import caching, binop ops etc --- tests/b.amal | 5 +++++ tests/io.amal | 2 ++ tests/main.amal | 8 +++++++- tests/main.c | 5 ++--- tests/sub/a.amal | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 tests/b.amal create mode 100644 tests/sub/a.amal (limited to 'tests') diff --git a/tests/b.amal b/tests/b.amal new file mode 100644 index 0000000..c7d833d --- /dev/null +++ b/tests/b.amal @@ -0,0 +1,5 @@ +const a = @import("io.amal"); + +const nothing = fn { + +} \ No newline at end of file diff --git a/tests/io.amal b/tests/io.amal index bb7935b..5505d44 100644 --- a/tests/io.amal +++ b/tests/io.amal @@ -1,3 +1,5 @@ +const a = @import("sub/a.amal"); + const puts = fn { } \ No newline at end of file diff --git a/tests/main.amal b/tests/main.amal index ba6247b..d085501 100644 --- a/tests/main.amal +++ b/tests/main.amal @@ -1,5 +1,10 @@ const io = @import("io.amal"); +const User = struct { + name: str; + age: i32; +} + const main = fn { var hello = fn { @@ -14,8 +19,9 @@ const main = fn { /* episfjpseifipesf */ + //io.puts("lole"); } const print = fn { -} +} \ No newline at end of file diff --git a/tests/main.c b/tests/main.c index 8e45ba4..2b57bcf 100644 --- a/tests/main.c +++ b/tests/main.c @@ -43,9 +43,8 @@ static CHECK_RESULT int test_hash_map() { int main() { amal_compiler compiler; + FileScopeReference *file_scope; int result; - const char *filepath; - filepath = "tests/main.amal"; return_if_error(test_hash_map()); @@ -55,7 +54,7 @@ int main() { return 1; } - result = amal_compiler_load_file(&compiler, create_buffer_view(filepath, strlen(filepath))); + result = amal_compiler_load_file(&compiler, "tests/main.amal", &file_scope); if(result != AMAL_COMPILER_OK) { fprintf(stderr, "Failed to load file, error code: %d\n", result); return 1; diff --git a/tests/sub/a.amal b/tests/sub/a.amal new file mode 100644 index 0000000..1e9c8a4 --- /dev/null +++ b/tests/sub/a.amal @@ -0,0 +1 @@ +const b = @import("../b.amal"); \ No newline at end of file -- cgit v1.2.3