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

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

Issue 2679393004: Fix all "dangerous-default-value" pylint warnings. (Closed)
Patch Set: Created 3 years, 10 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 # -*- 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 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 def test_mixing_unsigned_bool_bitfields(self): 2072 def test_mixing_unsigned_bool_bitfields(self):
2073 def errmsg(bool_bitfields, unsigned_bitfields, name): 2073 def errmsg(bool_bitfields, unsigned_bitfields, name):
2074 bool_list = ', '.join(bool_bitfields) 2074 bool_list = ', '.join(bool_bitfields)
2075 unsigned_list = ', '.join(unsigned_bitfields) 2075 unsigned_list = ', '.join(unsigned_bitfields)
2076 return ('The class %s contains mixed unsigned and bool bitfields, ' 2076 return ('The class %s contains mixed unsigned and bool bitfields, '
2077 'which will pack into separate words on the MSVC compiler.\n ' 2077 'which will pack into separate words on the MSVC compiler.\n '
2078 'Bool bitfields are [%s].\nUnsigned bitfields are [%s].\n' 2078 'Bool bitfields are [%s].\nUnsigned bitfields are [%s].\n'
2079 'Consider converting bool bitfields to unsigned. [runtime/b itfields] [5]' 2079 'Consider converting bool bitfields to unsigned. [runtime/b itfields] [5]'
2080 % (name, bool_list, unsigned_list)) 2080 % (name, bool_list, unsigned_list))
2081 2081
2082 def build_test_case(bitfields, name, will_warn, extra_warnings=[]): 2082 def build_test_case(bitfields, name, will_warn, extra_warnings=None):
2083 bool_bitfields = [] 2083 bool_bitfields = []
2084 unsigned_bitfields = [] 2084 unsigned_bitfields = []
2085 test_string = 'class %s {\n' % (name,) 2085 test_string = 'class %s {\n' % (name,)
2086 line = 2 2086 line = 2
2087 for bitfield in bitfields: 2087 for bitfield in bitfields:
2088 test_string += ' %s %s : %d;\n' % bitfield 2088 test_string += ' %s %s : %d;\n' % bitfield
2089 if bitfield[0] == 'bool': 2089 if bitfield[0] == 'bool':
2090 bool_bitfields.append('%d: %s' % (line, bitfield[1])) 2090 bool_bitfields.append('%d: %s' % (line, bitfield[1]))
2091 elif bitfield[0].startswith('unsigned'): 2091 elif bitfield[0].startswith('unsigned'):
2092 unsigned_bitfields.append('%d: %s' % (line, bitfield[1])) 2092 unsigned_bitfields.append('%d: %s' % (line, bitfield[1]))
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 def test_ne(self): 4135 def test_ne(self):
4136 """Test __ne__ inequality function.""" 4136 """Test __ne__ inequality function."""
4137 checker1 = self._checker() 4137 checker1 = self._checker()
4138 checker2 = self._checker() 4138 checker2 = self._checker()
4139 4139
4140 # != calls __ne__. 4140 # != calls __ne__.
4141 # By default, __ne__ always returns true on different objects. 4141 # By default, __ne__ always returns true on different objects.
4142 # Thus, just check the distinguishing case to verify that the 4142 # Thus, just check the distinguishing case to verify that the
4143 # code defines __ne__. 4143 # code defines __ne__.
4144 self.assertFalse(checker1 != checker2) 4144 self.assertFalse(checker1 != checker2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698