| OLD | NEW |
| 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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 ' [whitespace/parens] [4]', | 1580 ' [whitespace/parens] [4]', |
| 1581 'Consider using EXPECT_LT instead of EXPECT_TRUE(a < b)' | 1581 'Consider using EXPECT_LT instead of EXPECT_TRUE(a < b)' |
| 1582 ' [readability/check] [2]']) | 1582 ' [readability/check] [2]']) |
| 1583 self.assert_lint( | 1583 self.assert_lint( |
| 1584 'CHECK("foo" == "foo")', | 1584 'CHECK("foo" == "foo")', |
| 1585 'Consider using CHECK_EQ instead of CHECK(a == b)' | 1585 'Consider using CHECK_EQ instead of CHECK(a == b)' |
| 1586 ' [readability/check] [2]') | 1586 ' [readability/check] [2]') |
| 1587 | 1587 |
| 1588 self.assert_lint('CHECK_EQ("foo", "foo")', '') | 1588 self.assert_lint('CHECK_EQ("foo", "foo")', '') |
| 1589 | 1589 |
| 1590 def test_check_deprecated_macros(self): |
| 1591 self.assert_lint('ASSERT(foo)', 'ASSERT is deprecated. Use DCHECK or ' |
| 1592 'its variants instead. [build/deprecated] [5]') |
| 1593 self.assert_lint(' ASSERT_UNUSED(foo, foo)', 'ASSERT_UNUSED is ' |
| 1594 'deprecated. Use DCHECK or its variants instead. ' |
| 1595 '[build/deprecated] [5]') |
| 1596 self.assert_lint('ASSERT_NOT_REACHED()', 'ASSERT_NOT_REACHED is ' |
| 1597 'deprecated. Use NOTREACHED instead. ' |
| 1598 '[build/deprecated] [5]') |
| 1599 self.assert_lint('ASSERT_WITH_SECURITY_IMPLICATION(foo)', |
| 1600 'ASSERT_WITH_SECURITY_IMPLICATION is deprecated. Use ' |
| 1601 'SECURITY_DCHECK instead. [build/deprecated] [5]') |
| 1602 self.assert_lint('WTF_LOG(foo)', 'WTF_LOG is deprecated. Use DVLOG ' |
| 1603 'instead. [build/deprecated] [5]') |
| 1604 |
| 1605 self.assert_lint('FOO_BAR_ASSERT()', '') |
| 1606 self.assert_lint('ASSERT_NO_EXCEPTIONS', '') |
| 1607 |
| 1590 def test_brace_at_begin_of_line(self): | 1608 def test_brace_at_begin_of_line(self): |
| 1591 self.assert_lint('{', | 1609 self.assert_lint('{', |
| 1592 'This { should be at the end of the previous line' | 1610 'This { should be at the end of the previous line' |
| 1593 ' [whitespace/braces] [4]') | 1611 ' [whitespace/braces] [4]') |
| 1594 self.assert_multi_line_lint( | 1612 self.assert_multi_line_lint( |
| 1595 '#endif\n' | 1613 '#endif\n' |
| 1596 '{\n' | 1614 '{\n' |
| 1597 '}\n', | 1615 '}\n', |
| 1598 '') | 1616 '') |
| 1599 self.assert_multi_line_lint( | 1617 self.assert_multi_line_lint( |
| (...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3380 class Foo::Goo { | 3398 class Foo::Goo { |
| 3381 virtual ~Goo(); | 3399 virtual ~Goo(); |
| 3382 virtual void goo(); | 3400 virtual void goo(); |
| 3383 };''', | 3401 };''', |
| 3384 '') | 3402 '') |
| 3385 self.assert_multi_line_lint( | 3403 self.assert_multi_line_lint( |
| 3386 'class Foo { void foo(); };', | 3404 'class Foo { void foo(); };', |
| 3387 'More than one command on the same line [whitespace/newline] [4]') | 3405 'More than one command on the same line [whitespace/newline] [4]') |
| 3388 self.assert_multi_line_lint( | 3406 self.assert_multi_line_lint( |
| 3389 'class MyClass {\n' | 3407 'class MyClass {\n' |
| 3390 ' int getIntValue() { ASSERT(m_ptr); return *m_ptr; }\n' | 3408 ' int getIntValue() { DCHECK(m_ptr); return *m_ptr; }\n' |
| 3391 '};\n', | 3409 '};\n', |
| 3392 '') | 3410 '') |
| 3393 self.assert_multi_line_lint( | 3411 self.assert_multi_line_lint( |
| 3394 'class MyClass {\n' | 3412 'class MyClass {\n' |
| 3395 ' int getIntValue()\n' | 3413 ' int getIntValue()\n' |
| 3396 ' {\n' | 3414 ' {\n' |
| 3397 ' ASSERT(m_ptr); return *m_ptr;\n' | 3415 ' DCHECK(m_ptr); return *m_ptr;\n' |
| 3398 ' }\n' | 3416 ' }\n' |
| 3399 '};\n', | 3417 '};\n', |
| 3400 'More than one command on the same line [whitespace/newline] [4]') | 3418 'More than one command on the same line [whitespace/newline] [4]') |
| 3401 | 3419 |
| 3402 self.assert_multi_line_lint( | 3420 self.assert_multi_line_lint( |
| 3403 '''\ | 3421 '''\ |
| 3404 class Qualified::Goo : public Foo { | 3422 class Qualified::Goo : public Foo { |
| 3405 virtual void goo(); | 3423 virtual void goo(); |
| 3406 };''', | 3424 };''', |
| 3407 '') | 3425 '') |
| (...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5260 def test_ne(self): | 5278 def test_ne(self): |
| 5261 """Test __ne__ inequality function.""" | 5279 """Test __ne__ inequality function.""" |
| 5262 checker1 = self._checker() | 5280 checker1 = self._checker() |
| 5263 checker2 = self._checker() | 5281 checker2 = self._checker() |
| 5264 | 5282 |
| 5265 # != calls __ne__. | 5283 # != calls __ne__. |
| 5266 # By default, __ne__ always returns true on different objects. | 5284 # By default, __ne__ always returns true on different objects. |
| 5267 # Thus, just check the distinguishing case to verify that the | 5285 # Thus, just check the distinguishing case to verify that the |
| 5268 # code defines __ne__. | 5286 # code defines __ne__. |
| 5269 self.assertFalse(checker1 != checker2) | 5287 self.assertFalse(checker1 != checker2) |
| OLD | NEW |