test/test_graph.rb in graph-2.5.3 vs test/test_graph.rb in graph-2.6.0

- old
+ new

@@ -7,11 +7,11 @@ def clean gsub(/\s+(\[|\])/, ' \1') end end -class TestGraph < MiniTest::Unit::TestCase +class TestGraph < Minitest::Test attr_accessor :graph def assert_attribute k, v, a assert_kind_of Graph::Attribute, a assert_equal "#{k} = #{v}", a.attr @@ -107,10 +107,28 @@ graph.label "blah" assert_graph graph, 'label = "blah"', '"a" -> "b"' end + def test_delete_node + g = digraph do + node "a" + node "b" + end + + assert_equal 2, g.nodes.length + assert_equal 2, g.nodes_order.length + assert_equal %w[a b], g.nodes.keys.sort + + g.delete_node "a" + + assert_equal 1, g.nodes.length + assert_equal 1, g.nodes_order.length + assert_equal %w[b], g.nodes.keys.sort + end + + def test_label_html graph.label "<<B>blah</B>>" assert_graph graph, 'label = <<B>blah</B>>', '"a" -> "b"' end @@ -268,11 +286,11 @@ ensure File.unlink path rescue nil end end -class TestAttribute < MiniTest::Unit::TestCase +class TestAttribute < Minitest::Test attr_accessor :a def setup self.a = Graph::Attribute.new "blah" end @@ -310,11 +328,11 @@ assert_equal [a, b], n.attributes end end -class TestNode < MiniTest::Unit::TestCase +class TestNode < Minitest::Test attr_accessor :n def setup self.n = Graph::Node.new :graph, "n" end @@ -402,10 +420,10 @@ assert_equal '"n" [ blah ]', n.to_s.clean end end -class TestEdge < MiniTest::Unit::TestCase +class TestEdge < Minitest::Test attr_accessor :e def setup a = Graph::Node.new :graph, "a" b = Graph::Node.new :graph, "b"