Add some tests
This commit is contained in:
parent
48cb618d5a
commit
89a7780d10
8
tests/invalid_function_name_intrinsic.qbl
Normal file
8
tests/invalid_function_name_intrinsic.qbl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//invalid,Function name print at 1:22 is already an intrinsic
|
||||||
|
|
||||||
|
function int => print
|
||||||
|
{
|
||||||
|
deq
|
||||||
|
}
|
||||||
|
|
||||||
|
42 print
|
8
tests/invalid_function_name_operation.qbl
Normal file
8
tests/invalid_function_name_operation.qbl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//invalid,Expected function name but got deq at 3:20
|
||||||
|
|
||||||
|
function int => deq
|
||||||
|
{
|
||||||
|
deq
|
||||||
|
}
|
||||||
|
|
||||||
|
42 print
|
6
tests/missing_function_name.qbl
Normal file
6
tests/missing_function_name.qbl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//invalid,Expected function name but got { at 2:2
|
||||||
|
|
||||||
|
function int =>
|
||||||
|
{
|
||||||
|
deq
|
||||||
|
}
|
@ -1,3 +1,6 @@
|
|||||||
|
//valid
|
||||||
|
//output: Hello, World!\n4242test2Falsetesttesttest
|
||||||
|
|
||||||
"Hello, World!\n" print 43 foo foo deq
|
"Hello, World!\n" print 43 foo foo deq
|
||||||
|
|
||||||
|
|
||||||
@ -33,4 +36,4 @@ function int => whileFunction
|
|||||||
deq
|
deq
|
||||||
}
|
}
|
||||||
|
|
||||||
42 whileFunction
|
3 whileFunction
|
8
tests/typecheck_function_multiple_io.qbl
Normal file
8
tests/typecheck_function_multiple_io.qbl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//valid,output:42footesttest2stuff
|
||||||
|
|
||||||
|
function int str any => str str str foo
|
||||||
|
{
|
||||||
|
print req deq "test" "test2" "stuff" print
|
||||||
|
}
|
||||||
|
|
||||||
|
42 "foo" "bar" foo print print print
|
2
tests/unknown_function_basic.qbl
Normal file
2
tests/unknown_function_basic.qbl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
//invalid,Call to unknown function foo at 1:4
|
||||||
|
foo
|
19
tests/unknown_function_hard.qbl
Normal file
19
tests/unknown_function_hard.qbl
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
//invalid,Call to unknown function bar at 7:7
|
||||||
|
|
||||||
|
function int => foo
|
||||||
|
{
|
||||||
|
while
|
||||||
|
{
|
||||||
|
if
|
||||||
|
{
|
||||||
|
bar
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
1 -
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deq
|
||||||
|
}
|
||||||
|
|
||||||
|
42 foo
|
8
tests/unknown_function_in_function.qbl
Normal file
8
tests/unknown_function_in_function.qbl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//invalid,Call to unknown function bar at 3:5
|
||||||
|
|
||||||
|
function => foo
|
||||||
|
{
|
||||||
|
bar
|
||||||
|
}
|
||||||
|
|
||||||
|
foo
|
Reference in New Issue
Block a user