OLD | NEW |
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import re | 6 import re |
7 import shutil | 7 import shutil |
8 import sys | 8 import sys |
9 import tempfile | 9 import tempfile |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 shutil.rmtree(tmpdir) | 60 shutil.rmtree(tmpdir) |
61 | 61 |
62 # Copy comments and # commands from the beginning of the source to | 62 # Copy comments and # commands from the beginning of the source to |
63 # the beginning of the generated file, then copy the remaining | 63 # the beginning of the generated file, then copy the remaining |
64 # source to the end. | 64 # source to the end. |
65 d = open(dest, 'w') | 65 d = open(dest, 'w') |
66 s = open(src, 'r') | 66 s = open(src, 'r') |
67 t = open(tmp, 'r') | 67 t = open(tmp, 'r') |
68 while True: | 68 while True: |
69 line = s.readline() | 69 line = s.readline() |
70 if not (re.match('^\s+$', line) or line.startswith('//') or line.startswit
h('#')): | 70 if not (re.match('^\s+$', line) or line.startswith('//') |
| 71 or line.startswith('#')): |
71 break | 72 break |
72 d.write(line) | 73 d.write(line) |
73 d.write(t.read()) | 74 d.write(t.read()) |
74 os.remove(tmp) | 75 os.remove(tmp) |
75 d.write(line) | 76 d.write(line) |
76 d.write(s.read()) | 77 d.write(s.read()) |
77 | 78 |
78 def GetCommand(self): | 79 def GetCommand(self): |
79 # Parse the options by reading the .dart source file. | 80 # Parse the options by reading the .dart source file. |
80 source = self.GetSource() | 81 source = self.GetSource() |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 tests.append(DartStubTestCase(self.context, | 123 tests.append(DartStubTestCase(self.context, |
123 test_path, | 124 test_path, |
124 join(root, f), | 125 join(root, f), |
125 mode, | 126 mode, |
126 arch)) | 127 arch)) |
127 return tests | 128 return tests |
128 | 129 |
129 | 130 |
130 def GetConfiguration(context, root): | 131 def GetConfiguration(context, root): |
131 return DartStubTestConfiguration(context, root) | 132 return DartStubTestConfiguration(context, root) |
OLD | NEW |