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 | 5 |
6 import os | 6 import os |
7 from os.path import join, exists | 7 from os.path import join, exists |
8 import re | 8 import re |
9 | 9 |
10 import test | 10 import test |
11 import utils | 11 import utils |
12 | 12 |
13 | 13 |
14 class Error(Exception): | 14 class Error(Exception): |
15 pass | 15 pass |
16 | 16 |
17 | 17 |
18 class Co19TestCase(test.TestCase): | 18 class Co19TestCase(test.TestCase): |
19 def __init__(self, path, context, filename, mode, arch, component): | 19 def __init__(self, path, context, filename, mode, arch, component): |
20 super(Co19TestCase, self).__init__(context, path) | 20 super(Co19TestCase, self).__init__(context, path) |
21 self.filename = filename | 21 self.filename = filename |
22 self.mode = mode | 22 self.mode = mode |
23 self.arch = arch | 23 self.arch = arch |
24 self.component = component | 24 self.component = component |
25 self._is_negative = None | 25 self._is_negative = None |
26 | 26 |
27 def IsNegative(self): | 27 def IsNegative(self): |
28 if self._is_negative is None : | 28 if self._is_negative is None : |
29 contents = self.GetSource() | 29 contents = self.GetSource() |
30 for tag in ('@compile-error', | 30 if '@compile-error' in contents or '@runtime-error' in contents: |
31 # '@static-type-error', | 31 self._is_negative = True |
32 '@dynamic-type-error', '@runtime-error'): | 32 elif '@dynamic-type-error' in contents: |
33 if tag in contents: | 33 self._is_negative = self.context.checked |
34 self._is_negative = True | 34 else: |
35 break | |
36 else : | |
37 self._is_negative = False | 35 self._is_negative = False |
38 | |
39 return self._is_negative | 36 return self._is_negative |
40 | 37 |
41 def GetLabel(self): | 38 def GetLabel(self): |
42 return "%s%s %s %s" % (self.mode, self.arch, self.component, | 39 return "%s%s %s %s" % (self.mode, self.arch, self.component, |
43 "/".join(self.path)) | 40 "/".join(self.path)) |
44 | 41 |
45 def GetCommand(self): | 42 def GetCommand(self): |
46 # Parse the options by reading the .dart source file. | 43 # Parse the options by reading the .dart source file. |
47 source = self.GetSource() | 44 source = self.GetSource() |
48 vm_options = utils.ParseTestOptions(test.VM_OPTIONS_PATTERN, source, | 45 vm_options = utils.ParseTestOptions(test.VM_OPTIONS_PATTERN, source, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 patterns[idx : idx] = ['*'] * (len(file) - len(path)) | 145 patterns[idx : idx] = ['*'] * (len(file) - len(path)) |
149 path = [test.Pattern(p) for p in patterns] | 146 path = [test.Pattern(p) for p in patterns] |
150 | 147 |
151 for i in xrange(len(path)): | 148 for i in xrange(len(path)): |
152 if not path[i].match(file[i]): | 149 if not path[i].match(file[i]): |
153 return False | 150 return False |
154 return True | 151 return True |
155 | 152 |
156 def GetConfiguration(context, root): | 153 def GetConfiguration(context, root): |
157 return Co19TestConfiguration(context, root) | 154 return Co19TestConfiguration(context, root) |
OLD | NEW |