[Groonga-commit] ranguba/groonga-client-model at b85fbcb [master] Add a test for creating a patricia trie table

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Mar 3 09:19:43 JST 2017


Kouhei Sutou	2017-03-03 09:19:43 +0900 (Fri, 03 Mar 2017)

  New Revision: b85fbcbb35e746f074345847e5d4c4f02cdb4ee6
  https://github.com/ranguba/groonga-client-model/commit/b85fbcbb35e746f074345847e5d4c4f02cdb4ee6

  Message:
    Add a test for creating a patricia trie table

  Modified files:
    lib/groonga_client_model/migration.rb
    test/unit/test_migration.rb

  Modified: lib/groonga_client_model/migration.rb (+2 -2)
===================================================================
--- lib/groonga_client_model/migration.rb    2017-03-03 09:06:41 +0900 (20a4262)
+++ lib/groonga_client_model/migration.rb    2017-03-03 09:19:43 +0900 (a008256)
@@ -142,7 +142,7 @@ module GroongaClientModel
         message = "table type must be one of "
         message << "[:array, :hash_table, :patricia_trie, :double_array_trie]: "
         message << "#{type.inspect}"
-        raise InvalidArgument, message
+        raise ArgumentError, message
       end
     end
 
@@ -158,7 +158,7 @@ module GroongaClientModel
         message = "table type must be one of "
         message << "[:array, :hash_table, :patricia_trie, :double_array_trie]: "
         message << "#{type.inspect}"
-        raise InvalidArgument, message
+        raise ArgumentError, message
       end
     end
 

  Modified: test/unit/test_migration.rb (+23 -0)
===================================================================
--- test/unit/test_migration.rb    2017-03-03 09:06:41 +0900 (1482732)
+++ test/unit/test_migration.rb    2017-03-03 09:19:43 +0900 (2ff37e8)
@@ -87,6 +87,29 @@ table_create posts TABLE_NO_KEY
       end
     end
 
+    sub_test_case(":type => :patricia_trie") do
+      test("default") do
+        expected_up_report = <<-REPORT
+-- create_table(:terms, {:type=>"TABLE_PAT_KEY", :key_type=>"ShortText"})
+   -> 0.0s
+        REPORT
+        expected_down_report = <<-REPORT
+-- remove_table(:terms)
+   -> 0.0s
+        REPORT
+        expected_dump = <<-DUMP.chomp
+table_create terms TABLE_PAT_KEY ShortText
+      DUMP
+        assert_migrate(expected_up_report,
+                       expected_down_report,
+                       expected_dump) do |migration|
+          migration.instance_eval do
+            create_table(:terms, :type => :patricia_trie)
+          end
+        end
+      end
+    end
+
     sub_test_case("columns") do
       sub_test_case("#short_text") do
         test("default") do
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index