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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py

Issue 423073004: Fix diff generation by difflib to report missing end of file newlines. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/base.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 u'a\xac\u1234\u20ac\U00008000', 'act', 'exp.txt', 'act.txt') 136 u'a\xac\u1234\u20ac\U00008000', 'act', 'exp.txt', 'act.txt')
137 137
138 # And make sure we actually get diff output. 138 # And make sure we actually get diff output.
139 diff = port.diff_text('foo', 'bar', 'exp.txt', 'act.txt') 139 diff = port.diff_text('foo', 'bar', 'exp.txt', 'act.txt')
140 self.assertIn('foo', diff) 140 self.assertIn('foo', diff)
141 self.assertIn('bar', diff) 141 self.assertIn('bar', diff)
142 self.assertIn('exp.txt', diff) 142 self.assertIn('exp.txt', diff)
143 self.assertIn('act.txt', diff) 143 self.assertIn('act.txt', diff)
144 self.assertNotIn('nosuchthing', diff) 144 self.assertNotIn('nosuchthing', diff)
145 145
146 # Test for missing newline at end of file diff output.
147 content_a = "Hello\n\nWorld"
148 content_b = "Hello\n\nWorld\n\n\n"
149 expected = "--- exp.txt\n+++ act.txt\n@@ -1,3 +1,5 @@\n Hello\n \n-World \n\ No newline at end of file\n+World\n+\n+\n"
150 self.assertEqual(expected, port.diff_text(content_a, content_b, 'exp.txt ', 'act.txt'))
151
146 def test_setup_test_run(self): 152 def test_setup_test_run(self):
147 port = self.make_port() 153 port = self.make_port()
148 # This routine is a no-op. We just test it for coverage. 154 # This routine is a no-op. We just test it for coverage.
149 port.setup_test_run() 155 port.setup_test_run()
150 156
151 def test_test_dirs(self): 157 def test_test_dirs(self):
152 port = self.make_port() 158 port = self.make_port()
153 port.host.filesystem.write_text_file(port.layout_tests_dir() + '/canvas/ test', '') 159 port.host.filesystem.write_text_file(port.layout_tests_dir() + '/canvas/ test', '')
154 port.host.filesystem.write_text_file(port.layout_tests_dir() + '/css2.1/ test', '') 160 port.host.filesystem.write_text_file(port.layout_tests_dir() + '/css2.1/ test', '')
155 dirs = port.test_dirs() 161 dirs = port.test_dirs()
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args']) 467 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args'])
462 self.assertFalse(hasattr(suite, 'name')) 468 self.assertFalse(hasattr(suite, 'name'))
463 self.assertFalse(hasattr(suite, 'base')) 469 self.assertFalse(hasattr(suite, 'base'))
464 self.assertFalse(hasattr(suite, 'args')) 470 self.assertFalse(hasattr(suite, 'args'))
465 471
466 def test_legacy(self): 472 def test_legacy(self):
467 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args'], use_legacy _naming=True) 473 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args'], use_legacy _naming=True)
468 self.assertEqual(suite.name, 'virtual/suite/bar') 474 self.assertEqual(suite.name, 'virtual/suite/bar')
469 self.assertEqual(suite.base, 'base/foo') 475 self.assertEqual(suite.base, 'base/foo')
470 self.assertEqual(suite.args, ['--args']) 476 self.assertEqual(suite.args, ['--args'])
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698