Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:18:39 JST 2016
Kouhei Sutou 2012-11-25 22:45:22 +0900 (Sun, 25 Nov 2012) New Revision: b194074d8446e5803640fa466745605a98f2331d https://github.com/groonga/groonga-command/commit/b194074d8446e5803640fa466745605a98f2331d Message: Add load Added files: lib/groonga/command/load.rb test/command/test-load.rb Modified files: lib/groonga/command/parser.rb Added: lib/groonga/command/load.rb (+40 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/load.rb 2012-11-25 22:45:22 +0900 (3a477ff) @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +require "groonga/command/base" + +module Groonga + module Command + class Load < Base + Command.register("load", self) + + class << self + def parameter_names + [ + :values, + :table, + :columns, + :ifexists, + :input_type, + :each, + ] + end + end + end + end +end Modified: lib/groonga/command/parser.rb (+1 -0) =================================================================== --- lib/groonga/command/parser.rb 2012-11-25 19:45:06 +0900 (96150f7) +++ lib/groonga/command/parser.rb 2012-11-25 22:45:22 +0900 (f353fbe) @@ -21,6 +21,7 @@ require "cgi" require "groonga/command/base" require "groonga/command/select" +require "groonga/command/load" require "groonga/command/table-create" require "groonga/command/table-remove" require "groonga/command/table-rename" Added: test/command/test-load.rb (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-load.rb 2012-11-25 22:45:22 +0900 (2ba8908) @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +class LoadCommandTest < Test::Unit::TestCase + class CommandLineTest < self + include GroongaCommandTestUtils::CommandLineCommandParser + + def test_ordered_arguments + values = "[[\"Alice\"], [\"Bob\"]]" + table = "Users" + columns = "_key" + ifexists = "_key == \"Alice\"" + input_type = "json" + each = "strlen(_key)" + + command = parse(values, table, columns, ifexists, input_type, each) + assert_instance_of(Groonga::Command::Load, command) + assert_equal({ + :values => values, + :table => table, + :columns => columns, + :ifexists => ifexists, + :input_type => input_type, + :each => each, + }, + command.arguments) + end + + private + def parse(*arguments) + super("load", arguments, :output_type => false) + end + end +end -------------- next part -------------- HTML����������������������������... Télécharger