Skip to content

Commit 31f7bb6

Browse files
committed
feat(tests, vm): add tests for the type checking / arity errors produced by the builtins
1 parent 5c445a8 commit 31f7bb6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+215
-1
lines changed

src/arkreactor/VM/VM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ namespace Ark
16961696
}
16971697
else if (consecutive_similar_traces == 0)
16981698
{
1699-
fmt::println("{0:^{1}}", "...", 21 + func_name.size() + loc_as_text.size());
1699+
fmt::println(os, "{0:>{1}}", "...", (21 + func_name.size() + loc_as_text.size()) / 2);
17001700
++consecutive_similar_traces;
17011701
}
17021702

tests/unittests/resources/DiagnosticsSuite/runtime/recursion_depth.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ In file tests/unittests/resources/DiagnosticsSuite/runtime/recursion_depth.ark
99
5 | }))
1010

1111
[2047] In function `foo' (tests/unittests/resources/DiagnosticsSuite/runtime/recursion_depth.ark:3)
12+
...
1213
[ 1] In global scope (tests/unittests/resources/DiagnosticsSuite/runtime/recursion_depth.ark:7)
1314

1415
Current scope variables values:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(await 1)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Function await expected 1 argument
2+
-> future (UserType) was of type Number
3+
4+
In file tests/unittests/resources/DiagnosticsSuite/typeChecking/await_num.ark
5+
1 | (await 1)
6+
| ^~~~~~~~
7+
2 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(io:appendToFile 1 2)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Function io:appendToFile expected 2 arguments
2+
-> filename (String) was of type Number
3+
-> content (any)
4+
5+
In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.ark
6+
1 | (io:appendToFile 1 2)
7+
| ^~~~~~~~~~~~~~~~~~~~
8+
2 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(io:dir? 1)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Function io:dir? expected 1 argument
2+
-> path (String) was of type Number
3+
4+
In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.ark
5+
1 | (io:dir? 1)
6+
| ^~~~~~~~~~
7+
2 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(io:fileExists? 1)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Function io:fileExists? expected 1 argument
2+
-> filename (String) was of type Number
3+
4+
In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.ark
5+
1 | (io:fileExists? 1)
6+
| ^~~~~~~~~~~~~~~~~
7+
2 |

0 commit comments

Comments
 (0)