Mercurial > lcfOS
diff python/testc3.py @ 186:46d62dadd61b
Improved testsuite
author | Windel Bouwman |
---|---|
date | Sat, 25 May 2013 14:26:25 +0200 |
parents | e9b27f7193e3 |
children | bf5ab358f43a |
line wrap: on
line diff
--- a/python/testc3.py Fri May 24 20:45:03 2013 +0200 +++ b/python/testc3.py Sat May 25 14:26:25 2013 +0200 @@ -138,10 +138,10 @@ self.diag.clear() ir = self.builder.build(snippet) assert len(self.diag.diags) == 3 - assert self.diag.diags[0].loc.row == 8 - assert self.diag.diags[1].loc.row == 9 - assert self.diag.diags[2].loc.row == 10 - assert ir == None + self.assertEqual(self.diag.diags[0].loc.row, 8) + self.assertEqual(self.diag.diags[1].loc.row, 9) + self.assertEqual(self.diag.diags[2].loc.row, 10) + self.assertFalse(ir) def testEmpty(self): snippet = """ package A @@ -159,8 +159,8 @@ """ self.diag.clear() self.builder.build(snippet) - assert len(self.diag.diags) == 1 - assert self.diag.diags[0].loc.row == 5 + self.assertEqual(len(self.diag.diags), 1) + self.assertEqual(self.diag.diags[0].loc.row, 5) def testWhile(self): snippet = """ package tstwhile; @@ -171,11 +171,14 @@ while (i < 1054) { i = i + 3; - a = a + i + a = a + i; } } """ - self.builder.build(snippet) + ir = self.builder.build(snippet) + if not ir: + self.diag.printErrors(snippet) + self.assertTrue(ir) def testIf(self): snippet = """ package tstIFF; @@ -198,14 +201,14 @@ return b; } """ - self.builder.build(snippet) + ir = self.builder.build(snippet) + self.assertTrue(ir) def test2(self): # testsrc2 is valid code: self.diag.clear() ir = self.builder.build(testsrc2) - print(self.diag.diags) assert ir - ir.dump() + #ir.dump() if __name__ == '__main__': do()