OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Tests for chromium style checks for virtual/override/final specifiers on | 5 // Tests for chromium style checks for virtual/override/final specifiers on |
6 // virtual methods. | 6 // virtual methods. |
7 | 7 |
8 // Purposely use macros to test that the FixIt hints don't try to remove the | 8 // Purposely use macros to test that the FixIt hints don't try to remove the |
9 // macro body. | 9 // macro body. |
10 #define OVERRIDE override | 10 #define OVERRIDE override |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 public: | 54 public: |
55 virtual ~VirtualAndOverrideFinal() OVERRIDE FINAL {} | 55 virtual ~VirtualAndOverrideFinal() OVERRIDE FINAL {} |
56 virtual void F() OVERRIDE FINAL {} | 56 virtual void F() OVERRIDE FINAL {} |
57 }; | 57 }; |
58 | 58 |
59 class OverrideAndFinal : public Base { | 59 class OverrideAndFinal : public Base { |
60 public: | 60 public: |
61 ~OverrideAndFinal() OVERRIDE FINAL {} | 61 ~OverrideAndFinal() OVERRIDE FINAL {} |
62 void F() OVERRIDE FINAL {} | 62 void F() OVERRIDE FINAL {} |
63 }; | 63 }; |
| 64 |
| 65 // Finally, some simple sanity tests that overrides in the testing namespace |
| 66 // don't trigger warnings, except for testing::Test. |
| 67 namespace testing { |
| 68 |
| 69 class Test { |
| 70 public: |
| 71 virtual ~Test(); |
| 72 virtual void SetUp(); |
| 73 }; |
| 74 |
| 75 class NotTest { |
| 76 public: |
| 77 virtual ~NotTest(); |
| 78 virtual void SetUp(); |
| 79 }; |
| 80 |
| 81 } // namespace |
| 82 |
| 83 class MyTest : public testing::Test { |
| 84 public: |
| 85 virtual ~MyTest(); |
| 86 virtual void SetUp() override; |
| 87 }; |
| 88 |
| 89 class MyNotTest : public testing::NotTest { |
| 90 public: |
| 91 virtual ~MyNotTest(); |
| 92 virtual void SetUp() override; |
| 93 }; |
OLD | NEW |