[Groonga-commit] groonga/fluent-plugin-droonga at d67de31 [master] test command_mapper: add a test when register map has multiple pairs

Back to archive index

Kosuke Asami null+****@clear*****
Mon Jul 22 16:48:45 JST 2013


Kosuke Asami	2013-07-22 16:48:45 +0900 (Mon, 22 Jul 2013)

  New Revision: d67de3143d1afa21862bed8fc84f6f95629e7a3b
  https://github.com/groonga/fluent-plugin-droonga/commit/d67de3143d1afa21862bed8fc84f6f95629e7a3b

  Message:
    test command_mapper: add a test when register map has multiple pairs

  Modified files:
    lib/droonga/command_mapper.rb
    test/test_command_mapper.rb

  Modified: lib/droonga/command_mapper.rb (+4 -0)
===================================================================
--- lib/droonga/command_mapper.rb    2013-07-22 16:47:10 +0900 (c0fd664)
+++ lib/droonga/command_mapper.rb    2013-07-22 16:48:45 +0900 (9b4049b)
@@ -37,5 +37,9 @@ module Droonga
     def [](command)
       @commands[command.to_s]
     end
+
+    def commands
+      @commands.keys
+    end
   end
 end

  Modified: test/test_command_mapper.rb (+10 -0)
===================================================================
--- test/test_command_mapper.rb    2013-07-22 16:47:10 +0900 (6ade59e)
+++ test/test_command_mapper.rb    2013-07-22 16:48:45 +0900 (ac6f8fb)
@@ -30,5 +30,15 @@ class CommandMapperTest < Test::Unit::TestCase
       @command_mapper.register(:command_name => :method_name)
       assert_equal(:method_name, @command_mapper[:command_name])
     end
+
+    def test_multiple_pairs
+      map = {
+        :command_name_1 => :command_name_1,
+        :command_name_2 => :command_name_2,
+      }
+      @command_mapper.register(map)
+      assert_equal(["command_name_1", "command_name_2"],
+                   @command_mapper.commands)
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index