Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:17:48 JST 2016
Kouhei Sutou 2012-11-25 19:14:58 +0900 (Sun, 25 Nov 2012) New Revision: b91b0c2cf847aa094f64e637f7e35997523ce4b5 https://github.com/groonga/groonga-command/commit/b91b0c2cf847aa094f64e637f7e35997523ce4b5 Message: Add table_rename Added files: lib/groonga/command/table-rename.rb test/command/test-table-rename.rb Modified files: lib/groonga/command/parser.rb Modified: lib/groonga/command/parser.rb (+1 -0) =================================================================== --- lib/groonga/command/parser.rb 2012-11-25 19:12:15 +0900 (9567339) +++ lib/groonga/command/parser.rb 2012-11-25 19:14:58 +0900 (948dda1) @@ -23,6 +23,7 @@ require "groonga/command/base" require "groonga/command/select" require "groonga/command/table-create" require "groonga/command/table-remove" +require "groonga/command/table-rename" module Groonga module Command Added: lib/groonga/command/table-rename.rb (+36 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/table-rename.rb 2012-11-25 19:14:58 +0900 (4518ce2) @@ -0,0 +1,36 @@ +# -*- 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 TableRename < Base + Command.register("table_rename", self) + + class << self + def parameter_names + [ + :name, + :new_name, + ] + end + end + end + end +end Added: test/command/test-table-rename.rb (+40 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-table-rename.rb 2012-11-25 19:14:58 +0900 (f213929) @@ -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 + +class TableRenameCommandTest < Test::Unit::TestCase + class CommandLineTest < self + def test_ordered_arguments + name = "Users" + new_name = "People" + + command = parse("table_rename", name, new_name) + assert_instance_of(Groonga::Command::TableRename, command) + assert_equal({ + :name => name, + :new_name => new_name, + }, + command.arguments) + end + + private + def parse(command, *arguments) + command_line = "#{command} " + arguments.join(" ") + Groonga::Command::Parser.parse(command_line) + end + end +end -------------- next part -------------- HTML����������������������������... Download