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 logging.config | 6 import logging.config |
7 import unittest | 7 import unittest |
8 import templateloader | 8 import templateloader |
9 | 9 |
10 class TemplateLoaderTestCase(unittest.TestCase): | 10 class TemplateLoaderTestCase(unittest.TestCase): |
(...skipping 26 matching lines...) Expand all Loading... |
37 self.fail("'%s' does not contain '%s'" % (e, expected_message)) | 37 self.fail("'%s' does not contain '%s'" % (e, expected_message)) |
38 if not threw: | 38 if not threw: |
39 self.fail("missing error, expected '%s'" % expected_message) | 39 self.fail("missing error, expected '%s'" % expected_message) |
40 | 40 |
41 | 41 |
42 def test_freevar(self): | 42 def test_freevar(self): |
43 input_text = '''$A | 43 input_text = '''$A |
44 $B''' | 44 $B''' |
45 self._preprocess_test(input_text, {}, input_text) | 45 self._preprocess_test(input_text, {}, input_text) |
46 | 46 |
| 47 def test_comments(self): |
| 48 input_text = '''//$ comment 1 |
| 49 Hello |
| 50 //$ comment 2''' |
| 51 self._preprocess_test(input_text, {}, 'Hello\n') |
| 52 |
47 | 53 |
48 def test_ite1(self): | 54 def test_ite1(self): |
49 input_text = ''' | 55 input_text = ''' |
50 aaa | 56 aaa |
51 $if A | 57 $if A |
52 bbb | 58 bbb |
53 $else | 59 $else |
54 ccc | 60 ccc |
55 $endif | 61 $endif |
56 ddd | 62 ddd |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 input_text = ''' | 122 input_text = ''' |
117 $if A | 123 $if A |
118 $else | 124 $else |
119 ''' | 125 ''' |
120 self._preprocess_error_test(input_text, {'A':True}, 'Unterminated') | 126 self._preprocess_error_test(input_text, {'A':True}, 'Unterminated') |
121 | 127 |
122 if __name__ == "__main__": | 128 if __name__ == "__main__": |
123 logging.config.fileConfig("logging.conf") | 129 logging.config.fileConfig("logging.conf") |
124 if __name__ == '__main__': | 130 if __name__ == '__main__': |
125 unittest.main() | 131 unittest.main() |
OLD | NEW |