comparison python/testc3.py @ 194:b01429a5d695

Fixed test
author Windel Bouwman
date Wed, 29 May 2013 22:36:37 +0200
parents 6b2bec5653f1
children de3a68f677a5
comparison
equal deleted inserted replaced
193:f091e7d70996 194:b01429a5d695
134 c = a; 134 c = a;
135 c = b > 1; 135 c = b > 1;
136 } 136 }
137 """ 137 """
138 self.diag.clear() 138 self.diag.clear()
139 ir = self.builder.build(snippet) 139 ircode = self.builder.build(snippet)
140 self.assertEqual(len(self.diag.diags), 3) 140 self.assertEqual(len(self.diag.diags), 3)
141 self.assertEqual(self.diag.diags[0].loc.row, 8) 141 self.assertEqual(self.diag.diags[0].loc.row, 8)
142 self.assertEqual(self.diag.diags[1].loc.row, 9) 142 self.assertEqual(self.diag.diags[1].loc.row, 9)
143 self.assertEqual(self.diag.diags[2].loc.row, 10) 143 self.assertEqual(self.diag.diags[2].loc.row, 10)
144 self.assertFalse(ir) 144 self.assertFalse(ircode)
145 def testEmpty(self): 145 def testEmpty(self):
146 snippet = """ 146 snippet = """
147 package A 147 package A
148 """ 148 """
149 self.builder.build(snippet) 149 ircode = self.builder.build(snippet)
150 self.assertFalse(ircode)
150 def testEmpty2(self): 151 def testEmpty2(self):
151 snippet = "" 152 snippet = ""
152 self.builder.build(snippet) 153 self.diag.clear()
154 ircode = self.builder.build(snippet)
155 self.assertFalse(ircode)
153 def testRedefine(self): 156 def testRedefine(self):
154 snippet = """ 157 snippet = """
155 package test; 158 package test;
156 var int a; 159 var int a;
157 var int b; 160 var int b;
158 var int a; 161 var int a;
159 """ 162 """
160 self.diag.clear() 163 self.diag.clear()
161 self.builder.build(snippet) 164 ircode = self.builder.build(snippet)
165 self.assertFalse(ircode)
162 self.assertEqual(len(self.diag.diags), 1) 166 self.assertEqual(len(self.diag.diags), 1)
163 self.assertEqual(self.diag.diags[0].loc.row, 5) 167 self.assertEqual(self.diag.diags[0].loc.row, 5)
164 def testWhile(self): 168 def testWhile(self):
165 snippet = """ 169 snippet = """
166 package tstwhile; 170 package tstwhile;