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

Unified Diff: Tools/Scripts/webkitpy/formatter/main_unittest.py

Issue 555283006: Rework format-webkitpy to use single-quoting for chromium, add more args. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: Tools/Scripts/webkitpy/formatter/main_unittest.py
diff --git a/Tools/Scripts/webkitpy/formatter/main_unittest.py b/Tools/Scripts/webkitpy/formatter/main_unittest.py
index ff6b8a2970e44ee6c29cc12e6cbbaa39c1fc4014..2beb7cde55cc83c9dfcead8889983bc13f819e8f 100644
--- a/Tools/Scripts/webkitpy/formatter/main_unittest.py
+++ b/Tools/Scripts/webkitpy/formatter/main_unittest.py
@@ -40,34 +40,33 @@ EXPECTED_CHROMIUM_OUTPUT = '''
def foo():
"""triple-quoted docstring"""
try:
- bar = "bar"
+ bar = 'bar'
long_list = [
- "this is a list of strings that should be wrapped",
- "and consistently quoted"]
+ 'this is a list of strings that should be wrapped',
+ 'and consistently quoted']
longer_list = [
- "this is a list of strings that should be wrapped",
- "and consistently quoted",
+ 'this is a list of strings that should be wrapped',
+ 'and consistently quoted',
"because it's important to test quoting"]
except Exception as e:
pass
'''
+EXPECTED_ONLY_DOUBLE_QUOTED_OUTPUT = '''
+def foo():
+ """triple-quoted docstring"""
+ try:
+ bar = "bar"
+ long_list = ["this is a list of strings that should be wrapped", "and consistently quoted"]
+ longer_list = ["this is a list of strings that should be wrapped", "and consistently quoted", "because it's important to test quoting"]
+ except Exception, e:
+ pass
+'''
+
class TestMain(unittest.TestCase):
maxDiff = 4096
- def test_stdin_blink(self):
- host = MockSystemHost()
- host.stdin = StringIO.StringIO(ACTUAL_INPUT)
- main(host, ['-'])
- self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_BLINK_OUTPUT)
-
- def test_stdin_chromium(self):
- host = MockSystemHost()
- host.stdin = StringIO.StringIO(ACTUAL_INPUT)
- main(host, ['--chromium', '-'])
- self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_CHROMIUM_OUTPUT)
-
def test_files_blink(self):
host = MockSystemHost()
host.filesystem.files = {
@@ -84,3 +83,27 @@ class TestMain(unittest.TestCase):
main(host, ['--no-backups', 'test.py'])
self.assertEqual(host.filesystem.files, {
'test.py': EXPECTED_BLINK_OUTPUT})
+
+ def test_stdin_blink(self):
+ host = MockSystemHost()
+ host.stdin = StringIO.StringIO(ACTUAL_INPUT)
+ main(host, ['-'])
+ self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_BLINK_OUTPUT)
+
+ def test_stdin_chromium(self):
+ host = MockSystemHost()
+ host.stdin = StringIO.StringIO(ACTUAL_INPUT)
+ main(host, ['--chromium', '-'])
+ self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_CHROMIUM_OUTPUT)
+
+ def test_stdin_no_changes(self):
+ host = MockSystemHost()
+ host.stdin = StringIO.StringIO(ACTUAL_INPUT)
+ main(host, ['--no-autopep8', '--leave-strings-alone', '-'])
+ self.assertMultiLineEqual(host.stdout.getvalue(), ACTUAL_INPUT)
+
+ def test_stdin_only_double_quoting(self):
+ host = MockSystemHost()
+ host.stdin = StringIO.StringIO(ACTUAL_INPUT)
+ main(host, ['--no-autopep8', '--double-quote-strings', '-'])
+ self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_ONLY_DOUBLE_QUOTED_OUTPUT)
« Tools/Scripts/webkitpy/formatter/main.py ('K') | « Tools/Scripts/webkitpy/formatter/main.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698