Tests... LOTS OF TESTS
This commit is contained in:
parent
6ce5d406bb
commit
792a689005
9
tests/body-invalid-expr.json
Normal file
9
tests/body-invalid-expr.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
let @main : i32 in {
|
||||
1 + 3 * 5
|
||||
0 5 +
|
||||
}
|
9
tests/body-not-math-expr.json
Normal file
9
tests/body-not-math-expr.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/body-not-math-expr.sp
Normal file
3
tests/body-not-math-expr.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
syscall1(60, 1); // sys_exit(1)
|
||||
}
|
9
tests/declare-main.json
Normal file
9
tests/declare-main.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"file": "declare-main.sp",
|
||||
"compile": {
|
||||
"flags": [],
|
||||
"exit-code": 0,
|
||||
"stdout": "",
|
||||
"stderr": ""
|
||||
}
|
||||
}
|
1
tests/declare-main.sp
Normal file
1
tests/declare-main.sp
Normal file
@ -0,0 +1 @@
|
||||
let @main : i32;
|
9
tests/empty-let.json
Normal file
9
tests/empty-let.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
1
tests/empty-let.sp
Normal file
1
tests/empty-let.sp
Normal file
@ -0,0 +1 @@
|
||||
let;
|
9
tests/empty.json
Normal file
9
tests/empty.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
0
tests/empty.sp
Normal file
0
tests/empty.sp
Normal file
14
tests/exit-failure-calculated.json
Normal file
14
tests/exit-failure-calculated.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"file": "exit-failure-calculated.sp",
|
||||
"compile": {
|
||||
"flags": [],
|
||||
"exit-code": 0,
|
||||
"stdout": "",
|
||||
"stderr": ""
|
||||
},
|
||||
"run": {
|
||||
"exit-code": 3,
|
||||
"stdout": "",
|
||||
"stderr": ""
|
||||
}
|
||||
}
|
3
tests/exit-failure-calculated.sp
Normal file
3
tests/exit-failure-calculated.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
15 / 3 - 2
|
||||
}
|
@ -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": ""
|
||||
}
|
3
tests/exit-failure.sp
Normal file
3
tests/exit-failure.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
1
|
||||
}
|
14
tests/exit-success-calculated.json
Normal file
14
tests/exit-success-calculated.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"file": "exit-success-calculated.sp",
|
||||
"compile": {
|
||||
"flags": [],
|
||||
"exit-code": 0,
|
||||
"stdout": "",
|
||||
"stderr": ""
|
||||
},
|
||||
"run": {
|
||||
"exit-code": 0,
|
||||
"stdout": "",
|
||||
"stderr": ""
|
||||
}
|
||||
}
|
3
tests/exit-success-calculated.sp
Normal file
3
tests/exit-success-calculated.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
3 * 5 - 15
|
||||
}
|
14
tests/exit-success.json
Normal file
14
tests/exit-success.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"file": "exit-success.sp",
|
||||
"compile": {
|
||||
"flags": [],
|
||||
"exit-code": 0,
|
||||
"stdout": "",
|
||||
"stderr": ""
|
||||
},
|
||||
"run": {
|
||||
"exit-code": 0,
|
||||
"stdout": "",
|
||||
"stderr": ""
|
||||
}
|
||||
}
|
3
tests/exit-success.sp
Normal file
3
tests/exit-success.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
0
|
||||
}
|
9
tests/float-expr.json
Normal file
9
tests/float-expr.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/float-expr.sp
Normal file
3
tests/float-expr.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
3.141592
|
||||
}
|
9
tests/function-no-in.json
Normal file
9
tests/function-no-in.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/function-no-in.sp
Normal file
3
tests/function-no-in.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 {
|
||||
0
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
import penguin_boi;
|
||||
|
||||
let @main in {
|
||||
6 + 3
|
||||
}
|
9
tests/invalid-type.json
Normal file
9
tests/invalid-type.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/invalid-type.sp
Normal file
3
tests/invalid-type.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : u56 in {
|
||||
0
|
||||
}
|
9
tests/lex-multiple-periods.json
Normal file
9
tests/lex-multiple-periods.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/lex-multiple-periods.sp
Normal file
3
tests/lex-multiple-periods.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
3.45.6
|
||||
}
|
9
tests/lex-unfinished-string.json
Normal file
9
tests/lex-unfinished-string.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/lex-unfinished-string.sp
Normal file
3
tests/lex-unfinished-string.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
'This is a test
|
||||
}
|
9
tests/lex-unknown-symbol.json
Normal file
9
tests/lex-unknown-symbol.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/lex-unknown-symbol.sp
Normal file
3
tests/lex-unknown-symbol.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : i32 in {
|
||||
%4
|
||||
}
|
9
tests/missing-main.json
Normal file
9
tests/missing-main.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
1
tests/missing-main.sp
Normal file
1
tests/missing-main.sp
Normal file
@ -0,0 +1 @@
|
||||
let @hello : i64;
|
@ -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"
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
const { outln } from @'core/io';
|
||||
|
||||
let @main in {
|
||||
outln('Hello, world!');
|
||||
}
|
9
tests/unended-function.json
Normal file
9
tests/unended-function.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
1
tests/unended-function.sp
Normal file
1
tests/unended-function.sp
Normal file
@ -0,0 +1 @@
|
||||
let @main
|
9
tests/unmatched-bracket.json
Normal file
9
tests/unmatched-bracket.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
2
tests/unmatched-bracket.sp
Normal file
2
tests/unmatched-bracket.sp
Normal file
@ -0,0 +1,2 @@
|
||||
let @main : i32 in {
|
||||
0
|
9
tests/unmatched-type.json
Normal file
9
tests/unmatched-type.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
3
tests/unmatched-type.sp
Normal file
3
tests/unmatched-type.sp
Normal file
@ -0,0 +1,3 @@
|
||||
let @main : void in {
|
||||
0
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
import tests/wimport;
|
||||
|
||||
let @main in {
|
||||
0
|
||||
}
|
Loading…
Reference in New Issue
Block a user