From 7fc66326757d64d8c170977c31231d8a41ec3b7f Mon Sep 17 00:00:00 2001 From: Gabe Kopley Date: Tue, 4 Dec 2012 23:16:19 -0800 Subject: [PATCH] Fix for numberic labels, tested. Fixes #59. --- lib/graphviz/types/lbl_string.rb | 2 +- test/test_graph.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/graphviz/types/lbl_string.rb b/lib/graphviz/types/lbl_string.rb index 9aafd87..8db8902 100644 --- a/lib/graphviz/types/lbl_string.rb +++ b/lib/graphviz/types/lbl_string.rb @@ -6,7 +6,7 @@ def check(data) end def output - html = /^<([<|(^<)*<].*)>$/m.match(@data) + html = /^<([<|(^<)*<].*)>$/m.match(@data.to_s) if html != nil "<#{html[1]}>" else diff --git a/test/test_graph.rb b/test/test_graph.rb index f844d41..299924a 100644 --- a/test/test_graph.rb +++ b/test/test_graph.rb @@ -105,4 +105,13 @@ def test_search assert_equal c1.find_node("a0"), a0 assert_nil c1.search_node("a0") end + + def test_to_s + assert_nothing_raised 'to_s with edge with numeric label failed.' do + a = @graph.add_nodes('a') + b = @graph.add_nodes('b') + @graph.add_edges(a, b, label: 5) + @graph.to_s + end + end end