BIND 10 trac1068review3, updated. 64ac0166d5ea3b565f500f8a770dfa4d7d9f6a28 [1068] avoid TYPED_TEST for purely mock-specific test fixtures.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Sep 7 16:59:25 UTC 2011


The branch, trac1068review3 has been updated
       via  64ac0166d5ea3b565f500f8a770dfa4d7d9f6a28 (commit)
      from  ba50f189eced101999efb96672179aa1024204e9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 64ac0166d5ea3b565f500f8a770dfa4d7d9f6a28
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Sep 7 09:58:53 2011 -0700

    [1068] avoid TYPED_TEST for purely mock-specific test fixtures.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/tests/database_unittest.cc |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index ae5dff3..f1858bd 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -799,6 +799,11 @@ public:
 typedef ::testing::Types<MockAccessor, TestSQLite3Accessor> TestAccessorTypes;
 TYPED_TEST_CASE(DatabaseClientTest, TestAccessorTypes);
 
+// In some cases the entire test fixture is for the mock accessor only.
+// We use the usual TEST_F for them with the corresponding specialized class
+// to make the code simpler.
+typedef DatabaseClientTest<MockAccessor> MockDatabaseClientTest;
+
 TYPED_TEST(DatabaseClientTest, zoneNotFound) {
     DataSourceClient::FindResult zone(
         this->client_->findZone(Name("example.com")));
@@ -852,19 +857,14 @@ TEST(GenericDatabaseClientTest, notImplementedIterator) {
 
 // Pretend a bug in the connection and pass NULL as the context
 // Should not crash, but gracefully throw.  Works for the mock accessor only.
-TYPED_TEST(DatabaseClientTest, nullIteratorContext) {
-    if (this->is_mock_) {
-        EXPECT_THROW(this->client_->getIterator(Name("null.example.org")),
-                     isc::Unexpected);
-    }
+TEST_F(MockDatabaseClientTest, nullIteratorContext) {
+    EXPECT_THROW(this->client_->getIterator(Name("null.example.org")),
+                 isc::Unexpected);
 }
 
 // It doesn't crash or anything if the zone is completely empty.
 // Works for the mock accessor only.
-TYPED_TEST(DatabaseClientTest, emptyIterator) {
-    if (!this->is_mock_) {
-        return;
-    }
+TEST_F(MockDatabaseClientTest, emptyIterator) {
     ZoneIteratorPtr it(this->client_->getIterator(Name("empty.example.org")));
     EXPECT_EQ(ConstRRsetPtr(), it->getNextRRset());
     // This is past the end, it should throw
@@ -924,12 +924,8 @@ TYPED_TEST(DatabaseClientTest, iterator) {
 }
 
 // This has inconsistent TTL in the set (the rest, like nonsense in
-// the data is handled in rdata itself).  Work for mock iterator only.
-TYPED_TEST(DatabaseClientTest, badIterator) {
-    if (!this->is_mock_) {
-        return;
-    }
-
+// the data is handled in rdata itself).  Works for the mock accessor only.
+TEST_F(MockDatabaseClientTest, badIterator) {
     // It should not throw, but get the lowest one of them
     ZoneIteratorPtr it(this->client_->getIterator(Name("bad.example.org")));
     EXPECT_EQ(it->getNextRRset()->getTTL(), isc::dns::RRTTL(300));




More information about the bind10-changes mailing list