YUKI Hiroshi
null+****@clear*****
Thu Apr 30 11:03:05 JST 2015
YUKI Hiroshi 2015-04-30 11:03:05 +0900 (Thu, 30 Apr 2015) New Revision: c1f2ebfce7a04bd6de0e09687f4ab116870d90a8 https://github.com/droonga/droonga-engine/commit/c1f2ebfce7a04bd6de0e09687f4ab116870d90a8 Message: Add more tests for NodeName Modified files: test/unit/test_node_name.rb Modified: test/unit/test_node_name.rb (+34 -0) =================================================================== --- test/unit/test_node_name.rb 2015-04-30 10:27:07 +0900 (9868ee1) +++ test/unit/test_node_name.rb 2015-04-30 11:03:05 +0900 (724d53a) @@ -112,6 +112,35 @@ class NodeNameTest < Test::Unit::TestCase end end + class AttributeTest < self + def test_attributes + node_name = node_name("192.168.0.1", 2929, "droonga") + assert_equal({:host => "192.168.0.1", + :port => 2929, + :tag => "droonga"}, + {:host => node_name.host, + :port => node_name.port, + :tag => node_name.tag}) + end + end + + class ComparisonTest < self + def test_node_name_vs_string + string = "192.168.0.1:2929/droonga" + node_name = node_name("192.168.0.1", 2929, "droonga") + assert_true(node_name == string) + end + + #XXX This is a confusable behavior. It seems should be true + # but actually false, so you have to be careful when you + # compare string with Nodename. + def test_string_vs_node_name + string = "192.168.0.1:2929/droonga" + node_name = node_name("192.168.0.1", 2929, "droonga") + assert_false(string == node_name) + end + end + class FormatterTest < self def test_node assert_equal("192.168.0.1:2929/droonga", @@ -122,5 +151,10 @@ class NodeNameTest < Test::Unit::TestCase assert_equal("192.168.0.1:2929/droonga", node_name("192.168.0.1", 2929, "droonga").to_s) end + + def test_array + assert_equal(["192.168.0.1", 2929, "droonga"], + node_name("192.168.0.1", 2929, "droonga").to_a) + end end end -------------- next part -------------- HTML����������������������������...Download