Browse Source

[1788] more test, syntax cleanup

- added one test case for checking the new "filetype" item is optional.
- also added a test in MemoryDatasrcConfigTest to see whether "filetype" is
  accepted.
- others should be trivial editorial cleanup.
JINMEI Tatuya 13 years ago
parent
commit
36ec15a272

+ 1 - 2
src/bin/auth/auth.spec.pre.in

@@ -52,8 +52,7 @@
                 "item_type": "string",
                 "item_type": "string",
                 "item_optional": true,
                 "item_optional": true,
                 "item_default": "text"
                 "item_default": "text"
-              }
-	      ]
+              }]
             }
             }
           }]
           }]
         }
         }

+ 14 - 1
src/bin/auth/tests/config_syntax_unittest.cc

@@ -33,6 +33,19 @@ protected:
     ElementPtr errors_;
     ElementPtr errors_;
 };
 };
 
 
+TEST_F(AuthConfigSyntaxTest, inmemoryDefaultFileType) {
+    // filetype is optional
+    EXPECT_TRUE(
+        mspec_.validateConfig(
+            Element::fromJSON(
+                "{\"listen_on\": [], \"datasources\": "
+                "  [{\"type\": \"memory\", \"class\": \"IN\", "
+                "    \"zones\": [{\"origin\": \"example.com\","
+                "                 \"file\": \""
+                TEST_DATA_DIR "/example.zone\"}]}]}"),
+            true, errors_));
+}
+
 TEST_F(AuthConfigSyntaxTest, inmemorySQLite3Backend) {
 TEST_F(AuthConfigSyntaxTest, inmemorySQLite3Backend) {
     // Specifying non-default in-memory filetype
     // Specifying non-default in-memory filetype
     EXPECT_TRUE(
     EXPECT_TRUE(
@@ -48,7 +61,7 @@ TEST_F(AuthConfigSyntaxTest, inmemorySQLite3Backend) {
 }
 }
 
 
 TEST_F(AuthConfigSyntaxTest, badInmemoryFileType) {
 TEST_F(AuthConfigSyntaxTest, badInmemoryFileType) {
-    // Filetype must be a string
+    // filetype must be a string
     EXPECT_FALSE(
     EXPECT_FALSE(
         mspec_.validateConfig(
         mspec_.validateConfig(
             Element::fromJSON(
             Element::fromJSON(

+ 9 - 0
src/bin/auth/tests/config_unittest.cc

@@ -201,6 +201,15 @@ TEST_F(MemoryDatasrcConfigTest, addOneZone) {
         RRType::A())->code);
         RRType::A())->code);
 }
 }
 
 
+TEST_F(MemoryDatasrcConfigTest, addOneSQLite3Zone) {
+    parser->build(Element::fromJSON(
+                      "[{\"type\": \"memory\","
+                      "  \"zones\": [{\"origin\": \"example.com\","
+                      "               \"file\": \""
+                      TEST_DATA_DIR "/example.zone\","
+                      "               \"filetype\": \"sqlite3\"}]}]"));
+}
+
 TEST_F(MemoryDatasrcConfigTest, addMultiZones) {
 TEST_F(MemoryDatasrcConfigTest, addMultiZones) {
     EXPECT_NO_THROW(parser->build(Element::fromJSON(
     EXPECT_NO_THROW(parser->build(Element::fromJSON(
                       "[{\"type\": \"memory\","
                       "[{\"type\": \"memory\","