Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: testing/gmock/test/gmock_link_test.h

Issue 1151006: Update to current gtest/gmock. (Closed)
Patch Set: rebase Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/gmock/test/gmock_all_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009, Google Inc. 1 // Copyright 2009, 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 using testing::WithoutArgs; 178 using testing::WithoutArgs;
179 179
180 #if !GTEST_OS_WINDOWS_MOBILE 180 #if !GTEST_OS_WINDOWS_MOBILE
181 using testing::SetErrnoAndReturn; 181 using testing::SetErrnoAndReturn;
182 #endif 182 #endif
183 183
184 #if GTEST_HAS_EXCEPTIONS 184 #if GTEST_HAS_EXCEPTIONS
185 using testing::Throw; 185 using testing::Throw;
186 #endif 186 #endif
187 187
188 #if GMOCK_HAS_REGEX
189 using testing::ContainsRegex; 188 using testing::ContainsRegex;
190 using testing::MatchesRegex; 189 using testing::MatchesRegex;
191 #endif
192 190
193 class Interface { 191 class Interface {
194 public: 192 public:
195 virtual ~Interface() {} 193 virtual ~Interface() {}
196 virtual void VoidFromString(char* str) = 0; 194 virtual void VoidFromString(char* str) = 0;
197 virtual char* StringFromString(char* str) = 0; 195 virtual char* StringFromString(char* str) = 0;
198 virtual int IntFromString(char* str) = 0; 196 virtual int IntFromString(char* str) = 0;
199 virtual int& IntRefFromString(char* str) = 0; 197 virtual int& IntRefFromString(char* str) = 0;
200 virtual void VoidFromFunc(void(*)(char*)) = 0; 198 virtual void VoidFromFunc(void(*)(char*)) = 0;
201 virtual void VoidFromIntRef(int& n) = 0; 199 virtual void VoidFromIntRef(int& n) = 0;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 Mock mock; 538 Mock mock;
541 float a = 0; 539 float a = 0;
542 540
543 ON_CALL(mock, VoidFromFloat(FloatEq(a))).WillByDefault(Return()); 541 ON_CALL(mock, VoidFromFloat(FloatEq(a))).WillByDefault(Return());
544 ON_CALL(mock, VoidFromDouble(DoubleEq(a))).WillByDefault(Return()); 542 ON_CALL(mock, VoidFromDouble(DoubleEq(a))).WillByDefault(Return());
545 ON_CALL(mock, VoidFromFloat(NanSensitiveFloatEq(a))).WillByDefault(Return()); 543 ON_CALL(mock, VoidFromFloat(NanSensitiveFloatEq(a))).WillByDefault(Return());
546 ON_CALL(mock, VoidFromDouble(NanSensitiveDoubleEq(a))) 544 ON_CALL(mock, VoidFromDouble(NanSensitiveDoubleEq(a)))
547 .WillByDefault(Return()); 545 .WillByDefault(Return());
548 } 546 }
549 547
550 #if GMOCK_HAS_REGEX
551 // Tests the linkage of the ContainsRegex matcher. 548 // Tests the linkage of the ContainsRegex matcher.
552 TEST(LinkTest, TestMatcherContainsRegex) { 549 TEST(LinkTest, TestMatcherContainsRegex) {
553 Mock mock; 550 Mock mock;
554 551
555 ON_CALL(mock, VoidFromString(ContainsRegex(".*"))).WillByDefault(Return()); 552 ON_CALL(mock, VoidFromString(ContainsRegex(".*"))).WillByDefault(Return());
556 } 553 }
557 554
558 // Tests the linkage of the MatchesRegex matcher. 555 // Tests the linkage of the MatchesRegex matcher.
559 TEST(LinkTest, TestMatcherMatchesRegex) { 556 TEST(LinkTest, TestMatcherMatchesRegex) {
560 Mock mock; 557 Mock mock;
561 558
562 ON_CALL(mock, VoidFromString(MatchesRegex(".*"))).WillByDefault(Return()); 559 ON_CALL(mock, VoidFromString(MatchesRegex(".*"))).WillByDefault(Return());
563 } 560 }
564 #endif // GMOCK_HAS_REGEX
565 561
566 // Tests the linkage of the StartsWith, EndsWith, and HasSubstr matchers. 562 // Tests the linkage of the StartsWith, EndsWith, and HasSubstr matchers.
567 TEST(LinkTest, TestMatchersSubstrings) { 563 TEST(LinkTest, TestMatchersSubstrings) {
568 Mock mock; 564 Mock mock;
569 565
570 ON_CALL(mock, VoidFromString(StartsWith("a"))).WillByDefault(Return()); 566 ON_CALL(mock, VoidFromString(StartsWith("a"))).WillByDefault(Return());
571 ON_CALL(mock, VoidFromString(EndsWith("c"))).WillByDefault(Return()); 567 ON_CALL(mock, VoidFromString(EndsWith("c"))).WillByDefault(Return());
572 ON_CALL(mock, VoidFromString(HasSubstr("b"))).WillByDefault(Return()); 568 ON_CALL(mock, VoidFromString(HasSubstr("b"))).WillByDefault(Return());
573 } 569 }
574 570
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 EXPECT_FALSE(m.Matches(1)); 660 EXPECT_FALSE(m.Matches(1));
665 } 661 }
666 662
667 // Tests the linkage of the MatcherCast<T>() function. 663 // Tests the linkage of the MatcherCast<T>() function.
668 TEST(LinkTest, TestMatcherCast) { 664 TEST(LinkTest, TestMatcherCast) {
669 Matcher<const char*> m = MatcherCast<const char*>(_); 665 Matcher<const char*> m = MatcherCast<const char*>(_);
670 EXPECT_TRUE(m.Matches(NULL)); 666 EXPECT_TRUE(m.Matches(NULL));
671 } 667 }
672 668
673 #endif // GMOCK_TEST_GMOCK_LINK_TEST_H_ 669 #endif // GMOCK_TEST_GMOCK_LINK_TEST_H_
OLDNEW
« no previous file with comments | « testing/gmock/test/gmock_all_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698