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 // This file tests the C++ Mojo system macros and consists of "positive" tests, | 5 // This file tests the C++ Mojo system macros and consists of "positive" tests, |
6 // i.e., those verifying that things work (without compile errors, or even | 6 // i.e., those verifying that things work (without compile errors, or even |
7 // warnings if warnings are treated as errors). | 7 // warnings if warnings are treated as errors). |
8 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388) | 8 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388) |
9 // and write some "negative" tests. | 9 // and write some "negative" tests. |
10 | 10 |
11 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <stdint.h> | 14 #include <stdint.h> |
15 #include <stdlib.h> | 15 #include <stdlib.h> |
16 | 16 |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "gtest/gtest.h" |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Note: MSVS is very strict (and arguably buggy) about warnings for classes | 22 // Note: MSVS is very strict (and arguably buggy) about warnings for classes |
23 // defined in a local scope, so define these globally. | 23 // defined in a local scope, so define these globally. |
24 struct TestOverrideBaseClass { | 24 struct TestOverrideBaseClass { |
25 virtual ~TestOverrideBaseClass() {} | 25 virtual ~TestOverrideBaseClass() {} |
26 virtual void ToBeOverridden() {} | 26 virtual void ToBeOverridden() {} |
27 virtual void AlsoToBeOverridden() = 0; | 27 virtual void AlsoToBeOverridden() = 0; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 int ReturnsIntYouMustUse() { | 132 int ReturnsIntYouMustUse() { |
133 return 123; | 133 return 123; |
134 } | 134 } |
135 | 135 |
136 TEST(MacrosTest, IgnoreResult) { | 136 TEST(MacrosTest, IgnoreResult) { |
137 ignore_result(ReturnsIntYouMustUse()); | 137 ignore_result(ReturnsIntYouMustUse()); |
138 } | 138 } |
139 | 139 |
140 } // namespace | 140 } // namespace |
141 } // namespace mojo | 141 } // namespace mojo |
OLD | NEW |