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

Side by Side Diff: Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

Issue 609633004: Eliminate style rule about one space after punctuation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Tools/Scripts/webkitpy/style/checkers/cpp.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 # -*- coding: utf-8; -*- 1 # -*- coding: utf-8; -*-
2 # 2 #
3 # Copyright (C) 2011 Google Inc. All rights reserved. 3 # Copyright (C) 2011 Google Inc. All rights reserved.
4 # Copyright (C) 2009 Torch Mobile Inc. 4 # Copyright (C) 2009 Torch Mobile Inc.
5 # Copyright (C) 2009 Apple Inc. All rights reserved. 5 # Copyright (C) 2009 Apple Inc. All rights reserved.
6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) 6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are 9 # modification, are permitted provided that the following conditions are
10 # met: 10 # met:
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 self.assert_lint('foo();\n' 1894 self.assert_lint('foo();\n'
1895 '{ // A scope is opening.', '') 1895 '{ // A scope is opening.', '')
1896 self.assert_lint(' foo();\n' 1896 self.assert_lint(' foo();\n'
1897 ' { // An indented scope is opening.', '') 1897 ' { // An indented scope is opening.', '')
1898 self.assert_lint('if (foo) { // not a pure scope', 1898 self.assert_lint('if (foo) { // not a pure scope',
1899 '') 1899 '')
1900 self.assert_lint('printf("// In quotes.")', '') 1900 self.assert_lint('printf("// In quotes.")', '')
1901 self.assert_lint('printf("\\"%s // In quotes.")', '') 1901 self.assert_lint('printf("\\"%s // In quotes.")', '')
1902 self.assert_lint('printf("%s", "// In quotes.")', '') 1902 self.assert_lint('printf("%s", "// In quotes.")', '')
1903 1903
1904 def test_one_spaces_after_punctuation_in_comments(self): 1904 def test_line_ending_in_whitespace(self):
1905 self.assert_lint('int a; // This is a sentence.', 1905 self.assert_lint('int a; // This is a sentence.',
1906 '') 1906 '')
1907 self.assert_lint('int a; // This is a sentence. ', 1907 self.assert_lint('int a; // This is a sentence. ',
1908 'Line ends in whitespace. Consider deleting these extr a spaces. [whitespace/end_of_line] [4]') 1908 'Line ends in whitespace. Consider deleting these extr a spaces. [whitespace/end_of_line] [4]')
1909 self.assert_lint('int a; // This is a sentence. This is a another senten ce.',
1910 '')
1911 self.assert_lint('int a; // This is a sentence. This is a another sente nce.',
1912 'Should have only a single space after a punctuation in a comment. [whitespace/comments] [5]')
1913 self.assert_lint('int a; // This is a sentence! This is a another sente nce.',
1914 'Should have only a single space after a punctuation in a comment. [whitespace/comments] [5]')
1915 self.assert_lint('int a; // Why did I write this? This is a another sen tence.',
1916 'Should have only a single space after a punctuation in a comment. [whitespace/comments] [5]')
1917 self.assert_lint('int a; // Elementary, my dear.',
1918 'Should have only a single space after a punctuation in a comment. [whitespace/comments] [5]')
1919 self.assert_lint('int a; // The following should be clear: Is it?',
1920 'Should have only a single space after a punctuation in a comment. [whitespace/comments] [5]')
1921 self.assert_lint('int a; // Look at the follow semicolon; I hope this g ives an error.',
1922 'Should have only a single space after a punctuation in a comment. [whitespace/comments] [5]')
1923 1909
1924 def test_space_after_comment_marker(self): 1910 def test_space_after_comment_marker(self):
1925 self.assert_lint('//', '') 1911 self.assert_lint('//', '')
1926 self.assert_lint('//x', 'Should have a space between // and comment' 1912 self.assert_lint('//x', 'Should have a space between // and comment'
1927 ' [whitespace/comments] [4]') 1913 ' [whitespace/comments] [4]')
1928 self.assert_lint('// x', '') 1914 self.assert_lint('// x', '')
1929 self.assert_lint('//----', '') 1915 self.assert_lint('//----', '')
1930 self.assert_lint('//====', '') 1916 self.assert_lint('//====', '')
1931 self.assert_lint('//////', '') 1917 self.assert_lint('//////', '')
1932 self.assert_lint('////// x', '') 1918 self.assert_lint('////// x', '')
(...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after
5206 def test_ne(self): 5192 def test_ne(self):
5207 """Test __ne__ inequality function.""" 5193 """Test __ne__ inequality function."""
5208 checker1 = self._checker() 5194 checker1 = self._checker()
5209 checker2 = self._checker() 5195 checker2 = self._checker()
5210 5196
5211 # != calls __ne__. 5197 # != calls __ne__.
5212 # By default, __ne__ always returns true on different objects. 5198 # By default, __ne__ always returns true on different objects.
5213 # Thus, just check the distinguishing case to verify that the 5199 # Thus, just check the distinguishing case to verify that the
5214 # code defines __ne__. 5200 # code defines __ne__.
5215 self.assertFalse(checker1 != checker2) 5201 self.assertFalse(checker1 != checker2)
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/style/checkers/cpp.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698