Title: [219689] trunk/Tools
Revision
219689
Author
[email protected]
Date
2017-07-20 09:33:33 -0700 (Thu, 20 Jul 2017)

Log Message

lint-test-expectations should be run during style checking
https://bugs.webkit.org/show_bug.cgi?id=173559
<rdar://problem/32854941>

Reviewed by Aakash Jain.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationsModel._already_seen_better_match): Append returns 'None' when successful,
prevents identifying errors on specific lines in a file.
* Scripts/webkitpy/style/main_unittest.py:
(ExpectationLinterInStyleCheckerTest.test_linter_duplicate_line_edit_in_file): Test for the
case where a linter error is in the file modified, but the line modified is not related to
the linter error.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (219688 => 219689)


--- trunk/Tools/ChangeLog	2017-07-20 15:59:39 UTC (rev 219688)
+++ trunk/Tools/ChangeLog	2017-07-20 16:33:33 UTC (rev 219689)
@@ -1,3 +1,19 @@
+2017-07-20  Jonathan Bedard  <[email protected]>
+
+        lint-test-expectations should be run during style checking
+        https://bugs.webkit.org/show_bug.cgi?id=173559
+        <rdar://problem/32854941>
+
+        Reviewed by Aakash Jain.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectationsModel._already_seen_better_match): Append returns 'None' when successful,
+        prevents identifying errors on specific lines in a file.
+        * Scripts/webkitpy/style/main_unittest.py:
+        (ExpectationLinterInStyleCheckerTest.test_linter_duplicate_line_edit_in_file): Test for the
+        case where a linter error is in the file modified, but the line modified is not related to
+        the linter error.
+
 2017-07-20  Brady Eidson  <[email protected]>
 
         Remove WebIconDatabase from WebKitLegacy/win.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (219688 => 219689)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2017-07-20 15:59:39 UTC (rev 219688)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2017-07-20 16:33:33 UTC (rev 219689)
@@ -744,10 +744,12 @@
 
         # Missing files will be 'None'. It should be impossible to have a missing file which also has a line associated with it.
         assert shortened_previous_expectation_filename not in expectation_line.related_files or expectation_line.related_files[shortened_previous_expectation_filename] is not None
-        expectation_line.related_files[shortened_previous_expectation_filename] = expectation_line.related_files.get(shortened_previous_expectation_filename, []).append(prev_expectation_line.line_number)
+        expectation_line.related_files[shortened_previous_expectation_filename] = expectation_line.related_files.get(shortened_previous_expectation_filename, [])
+        expectation_line.related_files[shortened_previous_expectation_filename].append(prev_expectation_line.line_number)
 
         assert shortened_expectation_filename not in prev_expectation_line.related_files or prev_expectation_line.related_files[shortened_expectation_filename] is not None
-        prev_expectation_line.related_files[shortened_expectation_filename] = prev_expectation_line.related_files.get(shortened_expectation_filename, []).append(expectation_line.line_number)
+        prev_expectation_line.related_files[shortened_expectation_filename] = prev_expectation_line.related_files.get(shortened_expectation_filename, [])
+        prev_expectation_line.related_files[shortened_expectation_filename].append(expectation_line.line_number)
 
         return True
 

Modified: trunk/Tools/Scripts/webkitpy/style/main_unittest.py (219688 => 219689)


--- trunk/Tools/Scripts/webkitpy/style/main_unittest.py	2017-07-20 15:59:39 UTC (rev 219688)
+++ trunk/Tools/Scripts/webkitpy/style/main_unittest.py	2017-07-20 16:33:33 UTC (rev 219689)
@@ -149,6 +149,19 @@
             file_reader.do_association_check('/mock-checkout', host)
         self.assertEqual(scope.captured_output, ('', '', ''))
 
+    def test_linter_duplicate_line_edit_in_file(self):
+        files = {
+            '/mock-checkout/LayoutTests/TestExpectations':
+            '# TestExpectations\ncss1/test.html [ Failure ]\ncss1/test.html [ Failure ]\n'}
+        host = self._generate_testing_host(files)
+
+        scope = OutputCaptureScope()
+        with scope:
+            file_reader = self._generate_file_reader(host.filesystem)
+            file_reader.process_file('/mock-checkout/LayoutTests/TestExpectations', line_numbers=[1])
+            file_reader.do_association_check('/mock-checkout', host)
+        self.assertEqual(scope.captured_output, ('', '', ''))
+
     def test_linter_deleted_file(self):
         files = {
             '/mock-checkout/LayoutTests/TestExpectations':
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to