Commits

Sidharth Kuruvila committed d40a6b9

Got rid of the wrapper class SimpleTreeGraph
Moved down to scala version 2.9.0 to satisfy scalatest's dependency requirements

  • Participants
  • Parent commits 5f5989e

Comments (0)

Files changed (3)

project/build.properties

 project.name=graphviz
 sbt.version=0.7.7
 project.version=1.0
-build.scala.versions=2.9.0-1
+build.scala.versions=2.9.0
 project.initialize=false

src/main/scala/net/kuruvila/graphviz/DrawSimpleTree.scala

   def nodes: List[Statement] = nodeId.attr(nodeAttributes:_*) :: children.flatMap(_.nodes)
   def connections: List[Statement] = children.flatMap(_.connections(nodeId))
   def connections(parentId: Id): List[Statement] = (parentId --> nodeId)::children.flatMap(_.connections(nodeId))
-  def graph: Digraph = digraph(tree.nodes ++ tree.connections: _*)
+  def graph: Digraph = digraph(nodes ++ connections: _*)
 }

src/test/scala/net/kuruvila/graphviz/DrawSimpleTreeSpec.scala

       val childId = tree.children(0).nodeId
       connections must be === List(parentId --> childId)
     }
-  }
-
-  describe("A SimpleTreeGraph"){
-    it("must construct a digraph given a simple tree"){
+    it("must construct a digraph"){
       val tree = SimpleTree("parent", List(SimpleTree("child")))
-      val stg = new SimpleTreeGraph(tree)
-      val l = stg.graph
+      val stg = tree.graph
       val parentId = tree.nodeId
       val childId = tree.children(0).nodeId
       val expected = digraph(List(
         parentId.attr(label("parent")), childId.attr(label("child")), 
         parentId --> childId):_*).statements
-      stg.graph.statements must be === expected
+      stg.statements must be === expected
     }
   }
 }