Skip to content

Commit 704a545

Browse files
committed
Fix compiler warning about non-exhaustive match
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
1 parent c975283 commit 704a545

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/test/scala/scala/xml/ReuseNodesTest.scala

+8-12
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import org.junit.experimental.theories.Theory
99
import org.junit.experimental.theories.DataPoints
1010
import org.junit.runner.RunWith
1111
/**
12-
* This test verify that after the tranform, the resultant xml node
12+
* This test verifies that after the transform, the resultant xml node
1313
* uses as many old nodes as possible.
1414
*
1515
* Three transformers class for case -
16-
* One for orginal, one for modified, and one proposed which shows
16+
* One for original, one for modified, and one proposed which shows
1717
* all are equivalent when it comes to reusing as many nodes as possible
1818
*/
1919
object ReuseNodesTest {
@@ -83,13 +83,9 @@ class ReuseNodesTest {
8383
}
8484

8585
def recursiveAssert(original:Seq[Node], transformed:Seq[Node]):Unit = {
86-
(original.toList,transformed.toList) match {
87-
case (Nil, Nil) => {}
88-
case (x::xs,y::ys) => {
89-
recursiveAssert(x,y)
90-
recursiveAssert(xs,ys)
91-
}
92-
}
86+
original zip transformed foreach {
87+
case (x, y) => recursiveAssert(x, y)
88+
}
9389
}
9490

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

0 commit comments

Comments
 (0)