Haruka Yoshihara
null+****@clear*****
Mon Nov 26 15:29:31 JST 2012
Haruka Yoshihara 2012-11-26 15:29:31 +0900 (Mon, 26 Nov 2012) New Revision: 9c2b2ff517d20f948094d64cbf44aaec289d2d0d https://github.com/groonga/groonga-command/commit/9c2b2ff517d20f948094d64cbf44aaec289d2d0d Log: Add get Added files: lib/groonga/command/get.rb test/command/test-get.rb Modified files: lib/groonga/command/parser.rb Added: lib/groonga/command/get.rb (+39 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/get.rb 2012-11-26 15:29:31 +0900 (8b52e04) @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 Haruka Yoshihara <yoshihara �� 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 Get < Base + Command.register("get", self) + + class << self + def parameter_names + [ + :table, + :key, + :output_columns, + :id + ] + end + end + end + end +end + Modified: lib/groonga/command/parser.rb (+1 -0) =================================================================== --- lib/groonga/command/parser.rb 2012-11-26 14:29:36 +0900 (235d821) +++ lib/groonga/command/parser.rb 2012-11-26 15:29:31 +0900 (5429c2a) @@ -20,6 +20,7 @@ require "shellwords" require "cgi" require "groonga/command/base" +require "groonga/command/get" require "groonga/command/select" require "groonga/command/suggest" require "groonga/command/load" Added: test/command/test-get.rb (+44 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-get.rb 2012-11-26 15:29:31 +0900 (fdfd525) @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 Haruka Yoshihara <yoshihara �� 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 GetCommandTest < Test::Unit::TestCase + class CommandLineTest < self + include GroongaCommandTestUtils::CommandLineCommandParser + + def test_ordered_arguments + table = "Users" + key = "Alice" + output_columns = "name, address" + arguments = [table, key, output_columns] + command = parse(*arguments) + assert_instance_of(Groonga::Command::Get, command) + + expected_arguments = { + :table => table, + :key => key, + :output_columns => output_columns, + } + assert_equal(expected_arguments, command.arguments) + end + + private + def parse(*arguments) + super("get", arguments, :output_type => false) + end + end +end -------------- next part -------------- HTML����������������������������...Download