Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:18:37 JST 2016
Kouhei Sutou 2012-11-25 19:45:06 +0900 (Sun, 25 Nov 2012) New Revision: aa41a9a8b4e6e9afa26180d507fb831936f8332c https://github.com/groonga/groonga-command/commit/aa41a9a8b4e6e9afa26180d507fb831936f8332c Message: Add delete Added files: lib/groonga/command/delete.rb test/command/test-delete.rb Modified files: lib/groonga/command/parser.rb Added: lib/groonga/command/delete.rb (+38 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/delete.rb 2012-11-25 19:45:06 +0900 (5770242) @@ -0,0 +1,38 @@ +# -*- 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 Delete < Base + Command.register("delete", self) + + class << self + def parameter_names + [ + :table, + :key, + :id, + :filter, + ] + end + end + end + end +end Modified: lib/groonga/command/parser.rb (+1 -0) =================================================================== --- lib/groonga/command/parser.rb 2012-11-25 19:41:38 +0900 (e514d71) +++ lib/groonga/command/parser.rb 2012-11-25 19:45:06 +0900 (96150f7) @@ -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/delete" require "groonga/command/truncate" module Groonga Added: test/command/test-delete.rb (+45 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-delete.rb 2012-11-25 19:45:06 +0900 (7941912) @@ -0,0 +1,45 @@ +# -*- 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 DeleteCommandTest < Test::Unit::TestCase + class CommandLineTest < self + include GroongaCommandTestUtils::CommandLineCommandParser + + def test_ordered_arguments + table = "Users" + key = "Alice" + id = "29" + filter = "age == 20" + + command = parse(table, key, id, filter) + assert_instance_of(Groonga::Command::Delete, command) + assert_equal({ + :table => table, + :key => key, + :id => id, + :filter => filter, + }, + command.arguments) + end + + private + def parse(*arguments) + super("delete", arguments, :output_type => false) + end + end +end -------------- next part -------------- HTML����������������������������...Download