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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/command_unittest.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 # Copyright (c) 2016 Google Inc. All rights reserved. 1 # Copyright (c) 2016 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 29 matching lines...) Expand all
40 show_in_main_help = True 40 show_in_main_help = True
41 41
42 def __init__(self, **kwargs): 42 def __init__(self, **kwargs):
43 super(TrivialCommand, self).__init__(**kwargs) 43 super(TrivialCommand, self).__init__(**kwargs)
44 44
45 def execute(self, options, args, tool): 45 def execute(self, options, args, tool):
46 pass 46 pass
47 47
48 48
49 class DummyTool(object): 49 class DummyTool(object):
50
50 def name(self): 51 def name(self):
51 return "dummy-tool" 52 return "dummy-tool"
52 53
53 54
54 class CommandTest(unittest.TestCase): 55 class CommandTest(unittest.TestCase):
55 56
56 def test_name_with_arguments_with_two_args(self): 57 def test_name_with_arguments_with_two_args(self):
57 class TrivialCommandWithArgs(TrivialCommand): 58 class TrivialCommandWithArgs(TrivialCommand):
58 argument_names = "ARG1 ARG2" 59 argument_names = "ARG1 ARG2"
59 command = TrivialCommandWithArgs() 60 command = TrivialCommandWithArgs()
(...skipping 12 matching lines...) Expand all
72 73
73 def test_required_arguments(self): 74 def test_required_arguments(self):
74 class TrivialCommandWithRequiredAndOptionalArgs(TrivialCommand): 75 class TrivialCommandWithRequiredAndOptionalArgs(TrivialCommand):
75 argument_names = "ARG1 ARG2 [ARG3]" 76 argument_names = "ARG1 ARG2 [ARG3]"
76 two_required_arguments = TrivialCommandWithRequiredAndOptionalArgs() 77 two_required_arguments = TrivialCommandWithRequiredAndOptionalArgs()
77 expected_logs = ("2 arguments required, 1 argument provided. Provided: 'foo' Required: ARG1 ARG2\n" 78 expected_logs = ("2 arguments required, 1 argument provided. Provided: 'foo' Required: ARG1 ARG2\n"
78 "See 'dummy-tool help trivial' for usage.\n") 79 "See 'dummy-tool help trivial' for usage.\n")
79 exit_code = OutputCapture().assert_outputs(self, two_required_arguments. check_arguments_and_execute, 80 exit_code = OutputCapture().assert_outputs(self, two_required_arguments. check_arguments_and_execute,
80 [None, ["foo"], DummyTool()], expected_logs=expected_logs) 81 [None, ["foo"], DummyTool()], expected_logs=expected_logs)
81 self.assertEqual(exit_code, 1) 82 self.assertEqual(exit_code, 1)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698