Kouhei Sutou
null+****@clear*****
Sun Nov 25 19:41:38 JST 2012
Kouhei Sutou 2012-11-25 19:41:38 +0900 (Sun, 25 Nov 2012) New Revision: fe7ea146dcc822eb1e068f013ed5527bf1a15aea https://github.com/groonga/groonga-command/commit/fe7ea146dcc822eb1e068f013ed5527bf1a15aea Log: Add truncate Added files: lib/groonga/command/truncate.rb test/command/test-truncate.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:36:39 +0900 (c0e8ba8) +++ lib/groonga/command/parser.rb 2012-11-25 19:41:38 +0900 (e514d71) @@ -27,6 +27,7 @@ require "groonga/command/table-rename" require "groonga/command/column-create" require "groonga/command/column-remove" require "groonga/command/column-rename" +require "groonga/command/truncate" module Groonga module Command Added: lib/groonga/command/truncate.rb (+35 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/truncate.rb 2012-11-25 19:41:38 +0900 (4be33a1) @@ -0,0 +1,35 @@ +# -*- 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 Truncate < Base + Command.register("truncate", self) + + class << self + def parameter_names + [ + :table, + ] + end + end + end + end +end Added: test/command/test-truncate.rb (+39 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-truncate.rb 2012-11-25 19:41:38 +0900 (02069ff) @@ -0,0 +1,39 @@ +# -*- 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 TruncateCommandTest < Test::Unit::TestCase + class CommandLineTest < self + include GroongaCommandTestUtils::CommandLineCommandParser + + def test_ordered_arguments + table = "Users" + + command = parse(table) + assert_instance_of(Groonga::Command::Truncate, command) + assert_equal({ + :table => table, + }, + command.arguments) + end + + private + def parse(*arguments) + super("truncate", arguments, :output_type => false) + end + end +end -------------- next part -------------- HTML����������������������������... 다운로드