about summary refs log tree commit
path: root/test/test_show_nodes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_show_nodes.rb')
-rw-r--r--test/test_show_nodes.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_show_nodes.rb b/test/test_show_nodes.rb
index b4aa3a0..91e6f81 100644
--- a/test/test_show_nodes.rb
+++ b/test/test_show_nodes.rb
@@ -29,4 +29,26 @@ class TestShowNodes < Test::Unit::TestCase
     ].join("\n") << "\n"
     assert_equal expect, tmpout.string
   end
+
+  def test_show_nodes_specify_io
+    t = Patricia.new
+    assert_nothing_raised do
+      t.add("127.0.0.0/24")
+      t.add("192.168.1.0/24")
+      t.add("192.168.2.0/24")
+      t.add("192.168.3.100")
+      t.add("10.0.0.0/8", "pref_10")
+    end
+    tmpout = StringIO.new
+    assert_nothing_raised { t.show_nodes(tmpout) }
+    expect = [
+      "node: 10.0.0.0/8",
+      "node: 127.0.0.0/24",
+      "node: 192.168.1.0/24",
+      "node: 192.168.2.0/24",
+      "node: 192.168.3.100/32"
+    ].join("\n") << "\n"
+    assert_equal expect, tmpout.string
+  end
+
 end