Kouhei Sutou
null+****@clear*****
Fri Mar 14 17:59:32 JST 2014
Kouhei Sutou 2014-03-14 17:59:32 +0900 (Fri, 14 Mar 2014) New Revision: 0b990fca23f930a3fc5b38863c4359ecae05b751 https://github.com/groonga/groonga-command/commit/0b990fca23f930a3fc5b38863c4359ecae05b751 Message: Add key_type reader Modified files: lib/groonga/command/table-create.rb test/command/test-table-create.rb Modified: lib/groonga/command/table-create.rb (+6 -0) =================================================================== --- lib/groonga/command/table-create.rb 2014-03-14 16:48:17 +0900 (7f9b9e7) +++ lib/groonga/command/table-create.rb 2014-03-14 17:59:32 +0900 (fc0f15d) @@ -36,6 +36,12 @@ module Groonga end end + # @return [String, nil] Key type name, nil for array no key table. + # @since 1.0.7 + def key_type + self[:key_type] + end + def flags @flags ||= (self[:flags] || "").split(/\s*\|\s*/) end Modified: test/command/test-table-create.rb (+13 -1) =================================================================== --- test/command/test-table-create.rb 2014-03-14 16:48:17 +0900 (c3ee6cb) +++ test/command/test-table-create.rb 2014-03-14 17:59:32 +0900 (ac2cc35) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2012-2013 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2012-2014 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -54,6 +54,18 @@ class TableCreateCommandTest < Test::Unit::TestCase end end + class KeyTypeTest < self + def test_specified + command = table_create_command({"key_type" => "ShortText"}) + assert_equal("ShortText", command.key_type) + end + + def test_omitted + command = table_create_command + assert_nil(command.key_type) + end + end + class FlagsTest < self def test_multiple command = table_create_command({"flags" => "TABLE_PAT_KEY|KEY_WITH_SIS"}) -------------- next part -------------- HTML����������������������������...Download