Skip to content

Commit

Permalink
Adds a couple more unit tests for MS build
Browse files Browse the repository at this point in the history
  • Loading branch information
Altoids1 committed Oct 27, 2021
1 parent 58816b8 commit 646bcdd
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ jobs:
./x64/Release/Joao.exe ./testprograms/tests/2_blocks.jao
./x64/Release/Joao.exe ./testprograms/tests/3_functions.jao
./x64/Release/Joao.exe ./testprograms/tests/4_objects.jao
./x64/Release/Joao.exe ./testprograms/tests/5_strings.jao
./x64/Release/Joao.exe ./testprograms/tests/6_parser.jao
44 changes: 44 additions & 0 deletions testprograms/tests/5_strings.jao
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/foo(x)
{
return x .. " and omega";
}

/main()
{
Number TEST_NUMBER = 5;

##Concatenation
String cool = "cool";
if(cool .. " and good" != "cool and good")
{
throw /error/New(TEST_NUMBER,"Concatenation failed!");
}

##Comparison
if("A" > "B")
{
throw /error/New(TEST_NUMBER,"String comparison failed!");
}

##Logic
if(!"apple")
{
throw /error/New(TEST_NUMBER,"String logic failed!");
}

##Cloning
String cooler = cool;
if(cooler != "cool")
{
throw /error/New(TEST_NUMBER,"String cloning failed!");
}

##Passing strings
String alpha = "alpha";
if(foo(alpha) != "alpha and omega")
{
throw /error/New(TEST_NUMBER,"Passing strings as parameters failed!");
}

print("Test #" .. TEST_NUMBER .. " passed");
}
13 changes: 13 additions & 0 deletions testprograms/tests/6_parser.jao
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
##Goal here is to throw off the parser
/main()
{
Number TEST_NUMBER = 6;
Number paren = ((((((((((((((7))))))))))))));

for(Value x=0;x<10;x+=(1)){break 1;}

###
Long comment!
### ##Line comment!
print("Test #" .. TEST_NUMBER .. " passed");
}

0 comments on commit 646bcdd

Please sign in to comment.