Mercurial > lcfOS
comparison test/testc3.py @ 288:a747a45dcd78
Various styling work
author | Windel Bouwman |
---|---|
date | Thu, 21 Nov 2013 14:26:13 +0100 |
parents | 1c7c1e619be8 |
children | 534b94b40aa8 |
comparison
equal
deleted
inserted
replaced
287:1c7c1e619be8 | 288:a747a45dcd78 |
---|---|
128 import p1; | 128 import p1; |
129 var A b; | 129 var A b; |
130 """ | 130 """ |
131 self.expectOK([io.StringIO(s) for s in (p1, p2)]) | 131 self.expectOK([io.StringIO(s) for s in (p1, p2)]) |
132 | 132 |
133 def testPackageMutual(self): | |
134 p1 = """module p1; | |
135 import p2; | |
136 type int A; | |
137 var p2.B b; | |
138 """ | |
139 p2 = """module p2; | |
140 import p1; | |
141 var p1.A a; | |
142 """ | |
143 self.expectOK([io.StringIO(s) for s in (p1, p2)]) | |
144 | |
133 def testFunctArgs(self): | 145 def testFunctArgs(self): |
134 snippet = """ | 146 snippet = """ |
135 module testargs; | 147 module testargs; |
136 function void t2(int a, double b) | 148 function void t2(int a, double b) |
137 { | 149 { |
361 { | 373 { |
362 var gpio a; | 374 var gpio a; |
363 *cast<gpio>(*a); | 375 *cast<gpio>(*a); |
364 } | 376 } |
365 """ | 377 """ |
366 # TODO: remove the duplicate error: | |
367 self.expectErrors(snippet, [7, 7]) | 378 self.expectErrors(snippet, [7, 7]) |
368 | 379 |
369 def testComplexType(self): | 380 def testComplexType(self): |
370 snippet = """ | 381 snippet = """ |
371 module testpointer; | 382 module testpointer; |
399 msp->P1.x = a * x->P1.y; | 410 msp->P1.x = a * x->P1.y; |
400 } | 411 } |
401 """ | 412 """ |
402 self.expectOK(snippet) | 413 self.expectOK(snippet) |
403 | 414 |
415 @unittest.skip('To be rewritten') | |
404 def testExamples(self): | 416 def testExamples(self): |
405 """ Test all examples in the c3/examples directory """ | 417 """ Test all examples in the c3/examples directory """ |
406 example_filenames = glob.glob('./c3/examples/*.c3') | 418 example_filenames = glob.glob('./c3examples/*.c3') |
407 for filename in example_filenames: | 419 for filename in example_filenames: |
408 with open(filename, 'r') as f: | 420 with open(filename, 'r') as f: |
409 src = f.read() | 421 self.expectOK(f) |
410 self.expectOK(src, pack_dir='./c3/examples') | |
411 | 422 |
412 def test2(self): | 423 def test2(self): |
413 # testsrc2 is valid code: | 424 # testsrc2 is valid code: |
414 snippet = """ | 425 snippet = """ |
415 module test2; | 426 module test2; |