diff --git a/tests/body-invalid-expr.json b/tests/body-invalid-expr.json new file mode 100644 index 0000000..971b605 --- /dev/null +++ b/tests/body-invalid-expr.json @@ -0,0 +1,9 @@ +{ + "file": "body-invalid-expr.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/body-invalid-expr.sp:2:7: \u001b[31;49merror: \u001b[0;0mInvalid syntax\n2 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/calc.sp b/tests/body-invalid-expr.sp similarity index 58% rename from tests/calc.sp rename to tests/body-invalid-expr.sp index 5980bbd..02fd4d3 100644 --- a/tests/calc.sp +++ b/tests/body-invalid-expr.sp @@ -1,3 +1,3 @@ let @main : i32 in { - 1 + 3 * 5 + 0 5 + } \ No newline at end of file diff --git a/tests/body-not-math-expr.json b/tests/body-not-math-expr.json new file mode 100644 index 0000000..e1cb9bc --- /dev/null +++ b/tests/body-not-math-expr.json @@ -0,0 +1,9 @@ +{ + "file": "body-not-math-expr.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/body-not-math-expr.sp:2:5: \u001b[31;49merror: \u001b[0;0mexpected a number\n2 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/body-not-math-expr.sp b/tests/body-not-math-expr.sp new file mode 100644 index 0000000..fc85f3a --- /dev/null +++ b/tests/body-not-math-expr.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + syscall1(60, 1); // sys_exit(1) +} \ No newline at end of file diff --git a/tests/declare-main.json b/tests/declare-main.json new file mode 100644 index 0000000..7b86ff5 --- /dev/null +++ b/tests/declare-main.json @@ -0,0 +1,9 @@ +{ + "file": "declare-main.sp", + "compile": { + "flags": [], + "exit-code": 0, + "stdout": "", + "stderr": "" + } +} \ No newline at end of file diff --git a/tests/declare-main.sp b/tests/declare-main.sp new file mode 100644 index 0000000..abec666 --- /dev/null +++ b/tests/declare-main.sp @@ -0,0 +1 @@ +let @main : i32; \ No newline at end of file diff --git a/tests/empty-let.json b/tests/empty-let.json new file mode 100644 index 0000000..c61fc44 --- /dev/null +++ b/tests/empty-let.json @@ -0,0 +1,9 @@ +{ + "file": "empty-let.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/empty-let.sp:1:4: \u001b[31;49merror: \u001b[0;0mExpected @\n1 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/empty-let.sp b/tests/empty-let.sp new file mode 100644 index 0000000..e009539 --- /dev/null +++ b/tests/empty-let.sp @@ -0,0 +1 @@ +let; \ No newline at end of file diff --git a/tests/empty.json b/tests/empty.json new file mode 100644 index 0000000..671658c --- /dev/null +++ b/tests/empty.json @@ -0,0 +1,9 @@ +{ + "file": "empty.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/empty.sp:1:1: \u001b[31;49merror: \u001b[0;0mExpected let\n1 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/empty.sp b/tests/empty.sp new file mode 100644 index 0000000..e69de29 diff --git a/tests/exit-failure-calculated.json b/tests/exit-failure-calculated.json new file mode 100644 index 0000000..42f87c5 --- /dev/null +++ b/tests/exit-failure-calculated.json @@ -0,0 +1,14 @@ +{ + "file": "exit-failure-calculated.sp", + "compile": { + "flags": [], + "exit-code": 0, + "stdout": "", + "stderr": "" + }, + "run": { + "exit-code": 3, + "stdout": "", + "stderr": "" + } +} \ No newline at end of file diff --git a/tests/exit-failure-calculated.sp b/tests/exit-failure-calculated.sp new file mode 100644 index 0000000..cbdf22e --- /dev/null +++ b/tests/exit-failure-calculated.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + 15 / 3 - 2 +} \ No newline at end of file diff --git a/tests/calc.json b/tests/exit-failure.json similarity index 75% rename from tests/calc.json rename to tests/exit-failure.json index bebf357..0c3795e 100644 --- a/tests/calc.json +++ b/tests/exit-failure.json @@ -1,5 +1,5 @@ { - "file": "calc.sp", + "file": "exit-failure.sp", "compile": { "flags": [], "exit-code": 0, @@ -7,7 +7,7 @@ "stderr": "" }, "run": { - "exit-code": 16, + "exit-code": 1, "stdout": "", "stderr": "" } diff --git a/tests/exit-failure.sp b/tests/exit-failure.sp new file mode 100644 index 0000000..b2a1d00 --- /dev/null +++ b/tests/exit-failure.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + 1 +} \ No newline at end of file diff --git a/tests/exit-success-calculated.json b/tests/exit-success-calculated.json new file mode 100644 index 0000000..4ab245a --- /dev/null +++ b/tests/exit-success-calculated.json @@ -0,0 +1,14 @@ +{ + "file": "exit-success-calculated.sp", + "compile": { + "flags": [], + "exit-code": 0, + "stdout": "", + "stderr": "" + }, + "run": { + "exit-code": 0, + "stdout": "", + "stderr": "" + } +} \ No newline at end of file diff --git a/tests/exit-success-calculated.sp b/tests/exit-success-calculated.sp new file mode 100644 index 0000000..ded319f --- /dev/null +++ b/tests/exit-success-calculated.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + 3 * 5 - 15 +} \ No newline at end of file diff --git a/tests/exit-success.json b/tests/exit-success.json new file mode 100644 index 0000000..9f0c471 --- /dev/null +++ b/tests/exit-success.json @@ -0,0 +1,14 @@ +{ + "file": "exit-success.sp", + "compile": { + "flags": [], + "exit-code": 0, + "stdout": "", + "stderr": "" + }, + "run": { + "exit-code": 0, + "stdout": "", + "stderr": "" + } +} \ No newline at end of file diff --git a/tests/exit-success.sp b/tests/exit-success.sp new file mode 100644 index 0000000..cd95940 --- /dev/null +++ b/tests/exit-success.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + 0 +} \ No newline at end of file diff --git a/tests/float-expr.json b/tests/float-expr.json new file mode 100644 index 0000000..86a75d7 --- /dev/null +++ b/tests/float-expr.json @@ -0,0 +1,9 @@ +{ + "file": "float-expr.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1m\u001b[31;49merror: \u001b[0;0mInvalid function main\n" + } +} \ No newline at end of file diff --git a/tests/float-expr.sp b/tests/float-expr.sp new file mode 100644 index 0000000..86bc114 --- /dev/null +++ b/tests/float-expr.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + 3.141592 +} \ No newline at end of file diff --git a/tests/function-no-in.json b/tests/function-no-in.json new file mode 100644 index 0000000..ff39e5a --- /dev/null +++ b/tests/function-no-in.json @@ -0,0 +1,9 @@ +{ + "file": "function-no-in.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/function-no-in.sp:1:17: \u001b[31;49merror: \u001b[0;0mExpected 'in' or semicolon\n1 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/function-no-in.sp b/tests/function-no-in.sp new file mode 100644 index 0000000..93a2acc --- /dev/null +++ b/tests/function-no-in.sp @@ -0,0 +1,3 @@ +let @main : i32 { + 0 +} \ No newline at end of file diff --git a/tests/import-inexistent.json b/tests/import-inexistent.json deleted file mode 100644 index fe10082..0000000 --- a/tests/import-inexistent.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "file": "import-inexistent.sp", - "compile": { - "flags": [], - "exit-code": 1, - "stdout": "", - "stderr": "\u001b[1;1mtests/import-inexistent.sp:1:1: \u001b[31;49merror: \u001b[0;0mExpected let\n1 \n \u001b[31;49m^\u001b[0;0m\n" - } -} \ No newline at end of file diff --git a/tests/import-inexistent.sp b/tests/import-inexistent.sp deleted file mode 100644 index a984010..0000000 --- a/tests/import-inexistent.sp +++ /dev/null @@ -1,5 +0,0 @@ -import penguin_boi; - -let @main in { - 6 + 3 -} \ No newline at end of file diff --git a/tests/invalid-type.json b/tests/invalid-type.json new file mode 100644 index 0000000..6787a37 --- /dev/null +++ b/tests/invalid-type.json @@ -0,0 +1,9 @@ +{ + "file": "invalid-type.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/invalid-type.sp:1:13: \u001b[31;49merror: \u001b[0;0mExpected type name\n1 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/invalid-type.sp b/tests/invalid-type.sp new file mode 100644 index 0000000..9640dcc --- /dev/null +++ b/tests/invalid-type.sp @@ -0,0 +1,3 @@ +let @main : u56 in { + 0 +} \ No newline at end of file diff --git a/tests/lex-multiple-periods.json b/tests/lex-multiple-periods.json new file mode 100644 index 0000000..82cecfa --- /dev/null +++ b/tests/lex-multiple-periods.json @@ -0,0 +1,9 @@ +{ + "file": "lex-multiple-periods.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "\u001b[1;1mtests/lex-multiple-periods.sp:2:9: \u001b[33;49mwarning: \u001b[0;0mfloats can only have one dot\n2 3.45.6\n \u001b[33;49m^\u001b[0;0m\n", + "stderr": "\u001b[1;1mtests/lex-multiple-periods.sp:2:9: \u001b[31;49merror: \u001b[0;0mInvalid syntax\n2 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/lex-multiple-periods.sp b/tests/lex-multiple-periods.sp new file mode 100644 index 0000000..ea67f6b --- /dev/null +++ b/tests/lex-multiple-periods.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + 3.45.6 +} \ No newline at end of file diff --git a/tests/lex-unfinished-string.json b/tests/lex-unfinished-string.json new file mode 100644 index 0000000..f0724a0 --- /dev/null +++ b/tests/lex-unfinished-string.json @@ -0,0 +1,9 @@ +{ + "file": "lex-unfinished-string.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/lex-unfinished-string.sp:2:19: \u001b[31;49merror: \u001b[0;0mexpected end of string but got newline\n2 'This is a test\n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/lex-unfinished-string.sp b/tests/lex-unfinished-string.sp new file mode 100644 index 0000000..d0abc86 --- /dev/null +++ b/tests/lex-unfinished-string.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + 'This is a test +} \ No newline at end of file diff --git a/tests/lex-unknown-symbol.json b/tests/lex-unknown-symbol.json new file mode 100644 index 0000000..e282675 --- /dev/null +++ b/tests/lex-unknown-symbol.json @@ -0,0 +1,9 @@ +{ + "file": "lex-unknown-symbol.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/lex-unknown-symbol.sp:2:5: \u001b[31;49merror: \u001b[0;0munknown character\n2 %4\n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/lex-unknown-symbol.sp b/tests/lex-unknown-symbol.sp new file mode 100644 index 0000000..f177df6 --- /dev/null +++ b/tests/lex-unknown-symbol.sp @@ -0,0 +1,3 @@ +let @main : i32 in { + %4 +} \ No newline at end of file diff --git a/tests/missing-main.json b/tests/missing-main.json new file mode 100644 index 0000000..eb432c9 --- /dev/null +++ b/tests/missing-main.json @@ -0,0 +1,9 @@ +{ + "file": "missing-main.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1m\u001b[31;49merror: \u001b[0;0mMissing entry point: main\n" + } +} \ No newline at end of file diff --git a/tests/missing-main.sp b/tests/missing-main.sp new file mode 100644 index 0000000..15ae944 --- /dev/null +++ b/tests/missing-main.sp @@ -0,0 +1 @@ +let @hello : i64; \ No newline at end of file diff --git a/tests/simple.json b/tests/simple.json deleted file mode 100644 index e0b13f7..0000000 --- a/tests/simple.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "file": "simple.sp", - "compile": { - "flags": [], - "exit-code": 1, - "stdout": "", - "stderr": "\u001b[1;1mtests/simple.sp:1:1: \u001b[31;49merror: \u001b[0;0mExpected let\n1 \n \u001b[31;49m^\u001b[0;0m\n" - } -} \ No newline at end of file diff --git a/tests/simple.sp b/tests/simple.sp deleted file mode 100644 index 122be2f..0000000 --- a/tests/simple.sp +++ /dev/null @@ -1,5 +0,0 @@ -const { outln } from @'core/io'; - -let @main in { - outln('Hello, world!'); -} \ No newline at end of file diff --git a/tests/unended-function.json b/tests/unended-function.json new file mode 100644 index 0000000..9200a01 --- /dev/null +++ b/tests/unended-function.json @@ -0,0 +1,9 @@ +{ + "file": "unended-function.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/unended-function.sp:1:11: \u001b[31;49merror: \u001b[0;0mExpected 'in', colon or semicolon\n1 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/unended-function.sp b/tests/unended-function.sp new file mode 100644 index 0000000..893bfce --- /dev/null +++ b/tests/unended-function.sp @@ -0,0 +1 @@ +let @main \ No newline at end of file diff --git a/tests/unmatched-bracket.json b/tests/unmatched-bracket.json new file mode 100644 index 0000000..e8d6630 --- /dev/null +++ b/tests/unmatched-bracket.json @@ -0,0 +1,9 @@ +{ + "file": "unmatched-bracket.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1mtests/unmatched-bracket.sp:2:7: \u001b[31;49merror: \u001b[0;0mInvalid syntax\n2 \n \u001b[31;49m^\u001b[0;0m\n" + } +} \ No newline at end of file diff --git a/tests/unmatched-bracket.sp b/tests/unmatched-bracket.sp new file mode 100644 index 0000000..846b964 --- /dev/null +++ b/tests/unmatched-bracket.sp @@ -0,0 +1,2 @@ +let @main : i32 in { + 0 \ No newline at end of file diff --git a/tests/unmatched-type.json b/tests/unmatched-type.json new file mode 100644 index 0000000..ccb71b3 --- /dev/null +++ b/tests/unmatched-type.json @@ -0,0 +1,9 @@ +{ + "file": "unmatched-type.sp", + "compile": { + "flags": [], + "exit-code": 1, + "stdout": "", + "stderr": "\u001b[1;1m\u001b[31;49merror: \u001b[0;0mInvalid function main\n" + } +} \ No newline at end of file diff --git a/tests/unmatched-type.sp b/tests/unmatched-type.sp new file mode 100644 index 0000000..8400ac5 --- /dev/null +++ b/tests/unmatched-type.sp @@ -0,0 +1,3 @@ +let @main : void in { + 0 +} \ No newline at end of file diff --git a/tests/wimport.json b/tests/wimport.json deleted file mode 100644 index dfb4e6e..0000000 --- a/tests/wimport.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "file": "wimport.sp", - "compile": { - "flags": [], - "exit-code": 1, - "stdout": "", - "stderr": "\u001b[1;1mtests/wimport.sp:1:1: \u001b[31;49merror: \u001b[0;0mExpected let\n1 \n \u001b[31;49m^\u001b[0;0m\n" - } -} \ No newline at end of file diff --git a/tests/wimport.sp b/tests/wimport.sp deleted file mode 100644 index 0208763..0000000 --- a/tests/wimport.sp +++ /dev/null @@ -1,5 +0,0 @@ -import tests/wimport; - -let @main in { - 0 -} \ No newline at end of file