Changeset 90934 in webkit
- Timestamp:
- Jul 13, 2011 11:40:12 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r90932 r90934 1 2011-07-13 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Eliminate TestExpectationsFile. 4 https://bugs.webkit.org/show_bug.cgi?id=64458 5 6 Turns out, we can just use a Python list. 7 8 Reviewed by Adam Barth. 9 10 * Scripts/webkitpy/layout_tests/models/test_expectations.py: Folded TestExpectationsFile.append into TestExpectationParser.parse_list, 11 removed TestExpectationsFile. 12 * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Moved tests to better reflect new names, removed iterator test, 13 since there's no more custom iterator machinery. 14 1 15 2011-07-13 Philippe Normand <pnormand@igalia.com> 2 16 -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
r90920 r90934 196 196 197 197 @classmethod 198 def parse_list(cls, expectations_string, validator): 199 """Returns a list of TestExpectationLines, one for each line in expectations_string.""" 200 expectations = [] 201 line_number = 0 202 for line in expectations_string.split("\n"): 203 expectation, errors = cls.parse(line) 204 line_number += 1 205 expectation.valid = validator.validate(line_number, expectation, errors) 206 expectations.append(expectation) 207 return expectations 208 209 @classmethod 198 210 def _split_expectation_string(cls, line, errors): 199 211 """Splits line into a string of modifiers, a test name, a string of expectations, and a comment, … … 243 255 self.valid = False 244 256 self.malformed = False 245 246 247 class TestExpectationsFile:248 """Represents a test expectation file, which is a mutable collection of comments and test expectations."""249 250 def __init__(self):251 self._expectations = []252 253 def __iter__(self):254 return self._expectations.__iter__()255 256 def append(self, expectations_string, validator):257 """Add a TestExpectationLine for each item in expectations_string."""258 line_number = 0259 for line in expectations_string.split("\n"):260 expectation, errors = TestExpectationParser.parse(line)261 line_number += 1262 expectation.valid = validator.validate(line_number, expectation, errors)263 self._expectations.append(expectation)264 257 265 258 … … 401 394 402 395 self._matcher = ModifierMatcher(self._test_config) 403 self._expectations = TestExpectationsFile()404 396 self._overrides_allowed = False 405 self._expectations .append(expectations, self)397 self._expectations = TestExpectationParser.parse_list(expectations, self) 406 398 407 399 # List of tests that are in the overrides file (used for checking for … … 414 406 if overrides: 415 407 self._overrides_allowed = True 416 self._expectations .append(self._overrides, self)408 self._expectations += TestExpectationParser.parse_list(self._overrides, self) 417 409 self._overrides_allowed = False 418 410 -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
r90920 r90934 537 537 self.assertEqual(len(errors), 0) 538 538 539 def test_line_number_increment(self): 540 validator = TestValidator() 541 expectations = TestExpectationParser.parse_list('// Bar\nFOO : bar = BAZ\n\n', validator) 542 self.assertEqual(str(validator.line_numbers), '[1, 2, 3, 4]') 543 544 def test_validator_feedback(self): 545 validator = TestValidator() 546 expectations = TestExpectationParser.parse_list('FOO : bar1 = BAZ\nFOO : bar2 = BAZ\nFOO : bar3 = BAZ', validator) 547 line_number = 0 548 for expectation in expectations: 549 line_number += 1 550 self.assertEqual(line_number % 2 == 0, expectation.valid) 551 539 552 540 553 class TestExpectationSerializerTests(unittest.TestCase): … … 608 621 return line_number % 2 == 0 609 622 610 611 class TestExpectationsFileTests(unittest.TestCase):612 def test_line_number_increment(self):613 validator = TestValidator()614 expectations = TestExpectationsFile()615 expectations.append('// Bar\nFOO : bar = BAZ\n\n', validator)616 self.assertEqual(str(validator.line_numbers), '[1, 2, 3, 4]')617 618 def test_iterator(self):619 validator = TestValidator()620 expectations = TestExpectationsFile()621 expectations.append('\n\n\n\n', validator)622 line_number = 0623 for expectation in expectations:624 line_number += 1625 self.assertEqual(line_number, 5)626 627 def test_validator_feedback(self):628 validator = TestValidator()629 expectations = TestExpectationsFile()630 expectations.append('FOO : bar1 = BAZ\nFOO : bar2 = BAZ\nFOO : bar3 = BAZ', validator)631 line_number = 0632 for expectation in expectations:633 line_number += 1634 self.assertEqual(line_number % 2 == 0, expectation.valid)635 636 623 if __name__ == '__main__': 637 624 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.