[Groonga-commit] droonga/fluent-plugin-droonga at 9b479d5 [master] Add unit test for validation of add command

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Thu Dec 26 17:53:32 JST 2013


YUKI Hiroshi	2013-12-26 17:53:32 +0900 (Thu, 26 Dec 2013)

  New Revision: 9b479d57385a52d73cc74ae7dcc8f5cc86ad021c
  https://github.com/droonga/fluent-plugin-droonga/commit/9b479d57385a52d73cc74ae7dcc8f5cc86ad021c

  Message:
    Add unit test for validation of add command

  Modified files:
    test/unit/plugin/handler/test_add.rb

  Modified: test/unit/plugin/handler/test_add.rb (+32 -0)
===================================================================
--- test/unit/plugin/handler/test_add.rb    2013-12-26 17:47:42 +0900 (e6272c6)
+++ test/unit/plugin/handler/test_add.rb    2013-12-26 17:53:32 +0900 (10d56cc)
@@ -54,6 +54,8 @@ class AddHandlerTest < Test::Unit::TestCase
                             :type => :hash,
                             :key_type => :short_text) do |table|
           table.short_text("country")
+          table.int32("age")
+          table.time("birthday")
         end
       end
     end
@@ -91,6 +93,36 @@ class AddHandlerTest < Test::Unit::TestCase
         process(request)
       end
     end
+
+    def test_invalid_integer_value
+      request = {
+        "table"  => "Users",
+        "values" => {"age" => "secret"},
+      }
+      assert_raise(Droonga::AddHandler::InvalidValue) do
+        process(request)
+      end
+    end
+
+    def test_invalid_time_value
+      request = {
+        "table"  => "Users",
+        "values" => {"birthday" => "today"},
+      }
+      assert_raise(Droonga::AddHandler::InvalidValue) do
+        process(request)
+      end
+    end
+
+    def test_unknown_column
+      request = {
+        "table"  => "Users",
+        "values" => {"unknown" => "unknown"},
+      }
+      assert_raise(Droonga::AddHandler::UnknownColumn) do
+        process(request)
+      end
+    end
   end
 
   class NoKeyTest < self
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る