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 consists of "positive" tests, i.e., those verifying that things | 5 // This file consists of "positive" tests, i.e., those verifying that things |
6 // work (without compile errors, or even warnings if warnings are treated as | 6 // work (without compile errors, or even warnings if warnings are treated as |
7 // errors). | 7 // 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/system/macros.h" | 11 #include "mojo/public/c/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 "mojo/public/system/macros.h" | |
18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
19 | 18 |
20 namespace mojo { | 19 namespace mojo { |
21 namespace { | 20 namespace { |
22 | 21 |
23 TEST(MacrosTest, AllowUnused) { | 22 TEST(MacrosTest, AllowUnused) { |
24 // Test that no warning/error is issued even though |x| is unused. | 23 // Test that no warning/error is issued even though |x| is unused. |
25 int x MOJO_ALLOW_UNUSED = 123; | 24 int x MOJO_ALLOW_UNUSED = 123; |
26 } | 25 } |
27 | 26 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 EXPECT_FALSE(y.is_set()); | 139 EXPECT_FALSE(y.is_set()); |
141 EXPECT_TRUE(z.is_set()); | 140 EXPECT_TRUE(z.is_set()); |
142 EXPECT_EQ(123, z.value()); | 141 EXPECT_EQ(123, z.value()); |
143 z = z.Pass(); | 142 z = z.Pass(); |
144 EXPECT_TRUE(z.is_set()); | 143 EXPECT_TRUE(z.is_set()); |
145 EXPECT_EQ(123, z.value()); | 144 EXPECT_EQ(123, z.value()); |
146 } | 145 } |
147 | 146 |
148 } // namespace | 147 } // namespace |
149 } // namespace mojo | 148 } // namespace mojo |
OLD | NEW |