| OLD | NEW |
| 1 // Copyright 2008, Google Inc. | 1 // Copyright 2008, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 TEST_F(GMockOutputTest, MismatchArguments) { | 172 TEST_F(GMockOutputTest, MismatchArguments) { |
| 173 const std::string s = "Hi"; | 173 const std::string s = "Hi"; |
| 174 EXPECT_CALL(foo_, Bar(Ref(s), _, Ge(0))); | 174 EXPECT_CALL(foo_, Bar(Ref(s), _, Ge(0))); |
| 175 | 175 |
| 176 foo_.Bar("Ho", 0, -0.1); // Mismatch arguments | 176 foo_.Bar("Ho", 0, -0.1); // Mismatch arguments |
| 177 foo_.Bar(s, 0, 0); | 177 foo_.Bar(s, 0, 0); |
| 178 } | 178 } |
| 179 | 179 |
| 180 TEST_F(GMockOutputTest, MismatchWithArguments) { | 180 TEST_F(GMockOutputTest, MismatchWith) { |
| 181 EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1))) | 181 EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1))) |
| 182 .WithArguments(Ge()); | 182 .With(Ge()); |
| 183 | 183 |
| 184 foo_.Bar2(2, 3); // Mismatch WithArguments() | 184 foo_.Bar2(2, 3); // Mismatch With() |
| 185 foo_.Bar2(2, 1); | 185 foo_.Bar2(2, 1); |
| 186 } | 186 } |
| 187 | 187 |
| 188 TEST_F(GMockOutputTest, MismatchArgumentsAndWithArguments) { | 188 TEST_F(GMockOutputTest, MismatchArgumentsAndWith) { |
| 189 EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1))) | 189 EXPECT_CALL(foo_, Bar2(Ge(2), Ge(1))) |
| 190 .WithArguments(Ge()); | 190 .With(Ge()); |
| 191 | 191 |
| 192 foo_.Bar2(1, 3); // Mismatch arguments and mismatch WithArguments() | 192 foo_.Bar2(1, 3); // Mismatch arguments and mismatch With() |
| 193 foo_.Bar2(2, 1); | 193 foo_.Bar2(2, 1); |
| 194 } | 194 } |
| 195 | 195 |
| 196 TEST_F(GMockOutputTest, UnexpectedCallWithDefaultAction) { | 196 TEST_F(GMockOutputTest, UnexpectedCallWithDefaultAction) { |
| 197 ON_CALL(foo_, Bar2(_, _)) | 197 ON_CALL(foo_, Bar2(_, _)) |
| 198 .WillByDefault(Return(true)); // Default action #1 | 198 .WillByDefault(Return(true)); // Default action #1 |
| 199 ON_CALL(foo_, Bar2(1, _)) | 199 ON_CALL(foo_, Bar2(1, _)) |
| 200 .WillByDefault(Return(false)); // Default action #2 | 200 .WillByDefault(Return(false)); // Default action #2 |
| 201 | 201 |
| 202 EXPECT_CALL(foo_, Bar2(2, 2)); | 202 EXPECT_CALL(foo_, Bar2(2, 2)); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 testing::InitGoogleMock(&argc, argv); | 272 testing::InitGoogleMock(&argc, argv); |
| 273 | 273 |
| 274 // Ensures that the tests pass no matter what value of | 274 // Ensures that the tests pass no matter what value of |
| 275 // --gmock_catch_leaked_mocks and --gmock_verbose the user specifies. | 275 // --gmock_catch_leaked_mocks and --gmock_verbose the user specifies. |
| 276 testing::GMOCK_FLAG(catch_leaked_mocks) = true; | 276 testing::GMOCK_FLAG(catch_leaked_mocks) = true; |
| 277 testing::GMOCK_FLAG(verbose) = "warning"; | 277 testing::GMOCK_FLAG(verbose) = "warning"; |
| 278 | 278 |
| 279 TestCatchesLeakedMocksInAdHocTests(); | 279 TestCatchesLeakedMocksInAdHocTests(); |
| 280 return RUN_ALL_TESTS(); | 280 return RUN_ALL_TESTS(); |
| 281 } | 281 } |
| OLD | NEW |