mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Reworked the tests, read more
I've brought the tests up to scratch, except for compounds im the parser, because I'm too damn tired to do that over SSH. It looks like collections are right-recursive, whixh was unintended but still works just fine. I've also added the '--verbose' flag to the repl to control the debugging output. Several obscure bugs have been fixed, and comments have been tweaked. Mustfail tests are still needed, but that's a low priority. See #142. Fixed #151
This commit is contained in:
@@ -33,7 +33,7 @@ all: source repl run
|
||||
run: $(TEST_SCRIPTFILES:.toy=.toy-run)
|
||||
|
||||
%.toy-run: %.toy
|
||||
$(TEST_OUTDIR)/$(TEST_REPLNAME) -f ../$<
|
||||
$(TEST_OUTDIR)/$(TEST_REPLNAME) -f ../$< --verbose
|
||||
|
||||
#same as above, but with gdb
|
||||
gdb: source repl run-gdb
|
||||
@@ -41,7 +41,7 @@ gdb: source repl run-gdb
|
||||
run-gdb: $(TEST_SCRIPTFILES:.toy=.toy-gdb)
|
||||
|
||||
%.toy-gdb: %.toy
|
||||
gdb $(TEST_OUTDIR)/$(TEST_REPLNAME) -ix gdb_init -ex=run --batch --return-child-result --args "$(TEST_OUTDIR)/$(TEST_REPLNAME)" "-f" "../$<"
|
||||
gdb $(TEST_OUTDIR)/$(TEST_REPLNAME) -ix gdb_init -ex=run --batch --return-child-result --args "$(TEST_OUTDIR)/$(TEST_REPLNAME)" "-f" "../$<" "--verbose"
|
||||
|
||||
#compile the source and repl first
|
||||
source: $(TEST_OBJDIR) $(TEST_OUTDIR)
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
//basic expressions with no side effects (other than debug stack dumps)
|
||||
(1 + 2) * (3 + 4);
|
||||
|
||||
14
tests/integrations/test_keyword_assert.toy
Normal file
14
tests/integrations/test_keyword_assert.toy
Normal file
@@ -0,0 +1,14 @@
|
||||
//NOTE: these tests are all passing - failing tests can be found under the 'mustfails' directory
|
||||
|
||||
//basic assert statement
|
||||
assert true;
|
||||
|
||||
//assert on a string (tests for it's truthiness)
|
||||
assert "Hello world";
|
||||
|
||||
//assert on a condition
|
||||
assert 1 < 2;
|
||||
|
||||
//assert with an optional message
|
||||
assert true, "Assertion message";
|
||||
|
||||
@@ -13,7 +13,9 @@ print "Hello" .. "world!";
|
||||
//print with escaped characters
|
||||
print "\tHello\nworld";
|
||||
|
||||
//print from a leaf string
|
||||
//print from a substring string
|
||||
print "Hello world"[0,5];
|
||||
|
||||
//print from a substring, after a concat
|
||||
print ("hello" .. "world")[2,6];
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
var answer = 42;
|
||||
print answer; //42
|
||||
{
|
||||
var answer = 7;
|
||||
print answer; //7
|
||||
var answer = 7;
|
||||
print answer; //7
|
||||
}
|
||||
print answer; //42
|
||||
|
||||
@@ -11,9 +11,7 @@ print answer; //42
|
||||
var question = 42;
|
||||
print question; //42
|
||||
{
|
||||
var question = question;
|
||||
print question; //42
|
||||
var question = question;
|
||||
print question; //42
|
||||
}
|
||||
print question; //42
|
||||
|
||||
//TODO: scope test case
|
||||
|
||||
@@ -50,7 +50,7 @@ print !true; //false
|
||||
print !false; //true
|
||||
|
||||
//precedence
|
||||
print true && false || true; //TODO: a warning is needed for this
|
||||
print true && false || true; //TODO: a grouping warning is needed for this
|
||||
|
||||
//types
|
||||
var a: int;
|
||||
@@ -67,4 +67,9 @@ var c: int const = 42;
|
||||
|
||||
print c;
|
||||
|
||||
//indexing
|
||||
var s = "Hello" .. "world!";
|
||||
|
||||
print s[3, 3];
|
||||
|
||||
//TODO: type casting
|
||||
|
||||
Reference in New Issue
Block a user