Mark a couple bugs found to not lose track, and add a regression test.

This commit is contained in:
Sei Lisa 2016-06-28 03:47:48 +02:00
parent 980adff9c8
commit 30a07db4fb
2 changed files with 19 additions and 0 deletions

View file

@ -227,6 +227,15 @@ class Test02_Parser(UnitTestCase):
self.parser.parse('f(){if(1) {state default;}if (1) if (1) state default; else state default;}default{timer(){}}')
self.parser.parse('default{timer(){vector v;v.x=0;}}')
# Check for exceptions only
p = self.parser.parse('default{timer(){jump x;while(1)@x;}}')
self.outscript.output(p)
self.assertRaises(EParseUndefined, self.parser.parse,
'default{timer(){jump x;while(1){@x;}}}')
self.assertRaises(EParseUndefined, self.parser.parse,
'default{timer(){jump x;{while(1)@x;}}}')
def tearDown(self):
del self.parser
@ -478,6 +487,14 @@ class Test03_Optimizer(UnitTestCase):
# should raise no other exception
self.assertFalse(True)
p = self.parser.parse('default{timer(){jump x;while(1)@x;}}')
self.opt.optimize(p)
out = self.outscript.output(p)
print out
# FIXME: DCR produces invalid code, thinks the while can be eliminated
# due to the jump jumping past it. Extremely corner case, but maybe
# worth a fix.
def tearDown(self):
del self.parser
del self.opt