Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1474)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py

Issue 2349543002: In update_w3c_test_expectations use ExpectationLine.tokenize_line and refactor. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py
index a4f89006ee870120de4d9df474b136750c762929..b8b6711ccc6b8dc47b2a4610cdba62fd4a21cd12 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py
@@ -172,34 +172,62 @@ class UpdateW3CTestExpectationsTest(logtesting.LoggingTestCase):
}
})
- def test_write_to_test_expectations_under_comment(self):
+ def test_write_to_test_expectations_with_marker_comment(self):
expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
self.host.filesystem.files[expectations_path] = '# Tests added from W3C auto import bot\n'
line_adder = W3CExpectationsLineAdder(self.host)
- line_list = ['fake crbug [ foo ] fake/file/path.html [Pass]']
+ line_list = ['crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]']
line_adder.write_to_test_expectations(line_list)
value = line_adder.host.filesystem.read_text_file(expectations_path)
- self.assertEqual(value, '# Tests added from W3C auto import bot\nfake crbug [ foo ] fake/file/path.html [Pass]\n')
+ self.assertMultiLineEqual(
+ value,
+ ('# Tests added from W3C auto import bot\n'
+ 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]\n'))
- def test_write_to_test_expectations_to_eof(self):
+ def test_write_to_test_expectations_with_no_marker_comment(self):
expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
- self.host.filesystem.files[expectations_path] = 'not empty\n'
+ self.host.filesystem.files[expectations_path] = 'crbug.com/111 [ FakePlatform ]\n'
line_adder = W3CExpectationsLineAdder(self.host)
- line_list = ['fake crbug [ foo ] fake/file/path.html [Pass]']
+ line_list = ['crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]']
line_adder.write_to_test_expectations(line_list)
value = self.host.filesystem.read_text_file(expectations_path)
- self.assertEqual(
+ self.assertMultiLineEqual(
value,
- 'not empty\n\n# Tests added from W3C auto import bot\nfake crbug [ foo ] fake/file/path.html [Pass]')
+ ('crbug.com/111 [ FakePlatform ]\n'
+ '\n'
+ '# Tests added from W3C auto import bot\n'
+ 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]'))
- def test_write_to_test_expectations_skip_lines(self):
+ def test_write_to_test_expectations_skips_existing_lines(self):
expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
- self.host.filesystem.files[expectations_path] = 'dont copy me\n'
+ self.host.filesystem.files[expectations_path] = 'crbug.com/111 dont/copy/me.html [ Failure ]\n'
line_adder = W3CExpectationsLineAdder(self.host)
- line_list = ['[ ] dont copy me', '[ ] but copy me']
+ line_list = [
+ 'crbug.com/111 dont/copy/me.html [ Failure ]',
+ 'crbug.com/222 do/copy/me.html [ Failure ]'
+ ]
line_adder.write_to_test_expectations(line_list)
value = self.host.filesystem.read_text_file(expectations_path)
- self.assertEqual(value, 'dont copy me\n\n# Tests added from W3C auto import bot\n[ ] but copy me')
+ self.assertEqual(
+ value,
+ ('crbug.com/111 dont/copy/me.html [ Failure ]\n'
+ '\n'
+ '# Tests added from W3C auto import bot\n'
+ 'crbug.com/222 do/copy/me.html [ Failure ]'))
+
+ def test_write_to_test_expectations_with_marker_and_no_lines(self):
+ expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
+ self.host.filesystem.files[expectations_path] = (
+ '# Tests added from W3C auto import bot\n'
+ 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]\n')
+ line_adder = W3CExpectationsLineAdder(self.host)
+ line_adder.write_to_test_expectations([])
+ value = line_adder.host.filesystem.read_text_file(expectations_path)
+ self.assertMultiLineEqual(
+ value,
+ ('# Tests added from W3C auto import bot\n'
+ '\n'
+ 'crbug.com/123 [ FakePlatform ] fake/file/path.html [ Pass ]\n'))
def test_is_js_test_true(self):
self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/foo/bar.html'] = (
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698