test/test_graph.rb in graph-2.2.0 vs test/test_graph.rb in graph-2.3.0
- old
+ new
@@ -37,11 +37,10 @@
end
def test_colorscheme
assert_attribute "colorscheme", "blah", graph.colorscheme("blah")
assert_empty graph.node_attribs
- refute_respond_to graph, :c1
end
def test_colorscheme_n
cs = graph.colorscheme("reds", 5)
assert_attribute "colorscheme", "reds5", cs
@@ -61,11 +60,12 @@
assert_attribute "fontname", '"blah"', graph.font("blah")
end
def test_font_size
# cheating... but I didn't want to write a more complex assertion
- assert_attribute "fontname", '"blah", fontsize = 12', graph.font("blah", 12)
+ assert_attribute "fontname", '"blah"', graph.font("blah")
+ assert_attribute "fontsize", '12', graph.fontsize(12)
end
def test_digraph
g = digraph do
edge "a", "b", "c"
@@ -276,14 +276,28 @@
def test_plus
b = Graph::Attribute.new "halb"
c = a + b
- assert_equal "blah, halb", c.attr
+ assert_equal [a, b], c.attr
+ assert_equal "blah, halb", c.to_s
end
def test_to_s
assert_equal "blah", a.to_s
+ end
+end
+
+class TestCompoundAttribute < TestAttribute
+ def test_lshift
+ b = Graph::Attribute.new "halb"
+ n = Graph::Node.new nil, nil
+
+ c = a + b
+
+ c << n # paint the node with a + b
+
+ assert_equal [a, b], n.attributes
end
end
class TestNode < MiniTest::Unit::TestCase
attr_accessor :n