YUKI Hiroshi
null+****@clear*****
Wed Apr 23 19:07:17 JST 2014
YUKI Hiroshi 2014-04-23 19:07:17 +0900 (Wed, 23 Apr 2014) New Revision: 6be105107680ef30270767b93bbdcedcc670852a https://github.com/droonga/droonga-engine/commit/6be105107680ef30270767b93bbdcedcc670852a Message: test: Fix test cases for column_list command Modified files: test/unit/plugins/groonga/test_column_list.rb Modified: test/unit/plugins/groonga/test_column_list.rb (+56 -10) =================================================================== --- test/unit/plugins/groonga/test_column_list.rb 2014-04-23 18:50:06 +0900 (3916bad) +++ test/unit/plugins/groonga/test_column_list.rb 2014-04-23 19:07:17 +0900 (64bc128) @@ -68,14 +68,21 @@ class ColumnListTest < GroongaHandlerTest Groonga::Schema.define(:context => @context) do |schema| schema.create_table("Books", :type => :hash) schema.change_table("Books") do |table| - table.column("title", "ShortText", :type => :scalar) + table.column("age", "UInt32", :type => :scalar) end end response = process(:column_list, {"table" => "Books"}) expected = [ COLUMNS_HEADER, - [257, "title", path, "fix", "COLUMN_SCALAR", "Foo", "ShortText", []], + [257, + "age", + @database_path.to_s + ".0000101", + "fix", + "COLUMN_SCALAR", + "Books", + "UInt32", + []], ] assert_equal(expected, response.last) end @@ -84,6 +91,29 @@ class ColumnListTest < GroongaHandlerTest Groonga::Schema.define(:context => @context) do |schema| schema.create_table("Books", :type => :hash) schema.change_table("Books") do |table| + table.column("title", "ShortText", :type => :scalar) + end + end + response = process(:column_list, + {"table" => "Books"}) + expected = [ + COLUMNS_HEADER, + [257, + "title", + @database_path.to_s + ".0000101", + "var", + "COLUMN_SCALAR", + "Books", + "ShortText", + []], + ] + assert_equal(expected, response.last) + end + + def test_vector_column + Groonga::Schema.define(:context => @context) do |schema| + schema.create_table("Books", :type => :hash) + schema.change_table("Books") do |table| table.column("authors", "ShortText", :type => :vector) end end @@ -91,7 +121,14 @@ class ColumnListTest < GroongaHandlerTest {"table" => "Books"}) expected = [ COLUMNS_HEADER, - [257, "authors", path, "var", "COLUMN_VECTOR", "Foo", "ShortText", []], + [257, + "authors", + @database_path.to_s + ".0000101", + "var", + "COLUMN_VECTOR", + "Books", + "ShortText", + []], ] assert_equal(expected, response.last) end @@ -108,15 +145,24 @@ class ColumnListTest < GroongaHandlerTest {"table" => "Books"}) expected = [ COLUMNS_HEADER, - [257, "title", path, "fix", "COLUMN_SCALAR", "Foo", "ShortText", []], - [258, "entry_title", path, "index", "COLUMN_INDEX", "Foo", "Foo", ["Foo.age"]], + [258, + "entry_title", + @database_path.to_s + ".0000102", + "index", + "COLUMN_INDEX", + "Books", + "Books", + ["title"]], + [257, + "title", + @database_path.to_s + ".0000101", + "var", + "COLUMN_SCALAR", + "Books", + "ShortText", + []], ] assert_equal(expected, response.last) end - - private - def path - @context.database.path - end end end -------------- next part -------------- HTML����������������������������...Download