Skip to content

Commit

Permalink
Fix compiler warning about non-exhaustive match
Browse files Browse the repository at this point in the history
src/test/scala/scala/xml/ReuseNodesTest.scala:86: match may not be exhaustive.
It would fail on the following inputs: (List(_), Nil), (Nil, List(_))
    (original.toList,transformed.toList) match {
    ^
one warning found
  • Loading branch information
ashawley committed Jun 12, 2016
1 parent 55008bd commit a9c6eba
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/test/scala/scala/xml/ReuseNodesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import org.junit.experimental.theories.Theory
import org.junit.experimental.theories.DataPoints
import org.junit.runner.RunWith
/**
* This test verify that after the tranform, the resultant xml node
* This test verifies that after the transform, the resultant xml node
* uses as many old nodes as possible.
*
* Three transformers class for case -
* One for orginal, one for modified, and one proposed which shows
* One for original, one for modified, and one proposed which shows
* all are equivalent when it comes to reusing as many nodes as possible
*/
object ReuseNodesTest {
Expand Down Expand Up @@ -83,13 +83,9 @@ class ReuseNodesTest {
}

def recursiveAssert(original:Seq[Node], transformed:Seq[Node]):Unit = {
(original.toList,transformed.toList) match {
case (Nil, Nil) => {}
case (x::xs,y::ys) => {
recursiveAssert(x,y)
recursiveAssert(xs,ys)
}
}
original zip transformed foreach {
case (x, y) => recursiveAssert(x, y)
}
}

def recursiveAssert(original:Node, transformed:Node):Unit = {
Expand All @@ -98,9 +94,9 @@ class ReuseNodesTest {
recursiveAssert(original.child,transformed.child)
case _ => {
assertTrue(original eq transformed)
// No need to check for childrens, node being immuatable
// childs can't be differnt if parents are refertially equal
// No need to check for children, node being immuatable
// children can't be different if parents are referentially equal
}
}
}
}
}

0 comments on commit a9c6eba

Please sign in to comment.