| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import idlnode | 6 import idlnode |
| 7 import idlparser | 7 import idlparser |
| 8 import idlrenderer | 8 import idlrenderer |
| 9 import logging.config | 9 import logging.config |
| 10 import unittest | 10 import unittest |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 EXPECTED: | 23 EXPECTED: |
| 24 %s | 24 %s |
| 25 ACTUAL : | 25 ACTUAL : |
| 26 %s | 26 %s |
| 27 ''' % (expected_text, output_text) | 27 ''' % (expected_text, output_text) |
| 28 self.fail(msg) | 28 self.fail(msg) |
| 29 | 29 |
| 30 def test_rendering(self): | 30 def test_rendering(self): |
| 31 input_text = \ | 31 input_text = \ |
| 32 '''module M { | 32 '''module M { |
| 33 interface I : @A J, K { | 33 [Constructor(long x)] interface I : @A J, K { |
| 34 attribute int attr; | 34 attribute int attr; |
| 35 readonly attribute long attr2; | 35 readonly attribute long attr2; |
| 36 getter attribute int get_attr; | 36 getter attribute int get_attr; |
| 37 setter attribute int set_attr; | 37 setter attribute int set_attr; |
| 38 | 38 |
| 39 [A,B=123] void function(in long x, in optional boolean y); | 39 [A,B=123] void function(in long x, in optional boolean y); |
| 40 | 40 |
| 41 const boolean CONST = 1; | 41 const boolean CONST = 1; |
| 42 | 42 |
| 43 @A @B() @C(x) @D(x=1) @E(x,y=2) | 43 @A @B() @C(x) @D(x=1) @E(x,y=2) |
| 44 void something(); | 44 void something(); |
| 45 }; | 45 }; |
| 46 };''' | 46 };''' |
| 47 | 47 |
| 48 expected_text = \ | 48 expected_text = \ |
| 49 '''module M { | 49 '''module M { |
| 50 interface I : | 50 [Constructor(in long x)] interface I : |
| 51 @A J, | 51 @A J, |
| 52 K { | 52 K { |
| 53 | 53 |
| 54 /* Constants */ | 54 /* Constants */ |
| 55 const boolean CONST = 1; | 55 const boolean CONST = 1; |
| 56 | 56 |
| 57 /* Attributes */ | 57 /* Attributes */ |
| 58 attribute int attr; | 58 attribute int attr; |
| 59 attribute long attr2; | 59 attribute long attr2; |
| 60 getter attribute int get_attr; | 60 getter attribute int get_attr; |
| 61 setter attribute int set_attr; | 61 setter attribute int set_attr; |
| 62 | 62 |
| 63 /* Operations */ | 63 /* Operations */ |
| 64 [A, B=123] void function(in long x, in optional boolean y); | 64 [A, B=123] void function(in long x, in optional boolean y); |
| 65 @A @B @C(x) @D(x=1) @E(x, y=2) void something(); | 65 @A @B @C(x) @D(x=1) @E(x, y=2) void something(); |
| 66 }; | 66 }; |
| 67 }; | 67 }; |
| 68 ''' | 68 ''' |
| 69 self._run_test(input_text, expected_text) | 69 self._run_test(input_text, expected_text) |
| 70 | 70 |
| 71 if __name__ == "__main__": | 71 if __name__ == "__main__": |
| 72 logging.config.fileConfig("logging.conf") | 72 logging.config.fileConfig("logging.conf") |
| 73 if __name__ == '__main__': | 73 if __name__ == '__main__': |
| 74 unittest.main() | 74 unittest.main() |
| OLD | NEW |