Skip to content

Commit 3e33103

Browse files
author
Dean Wampler
committed
Improved a test for ticket #43
1 parent c91dbcf commit 3e33103

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/scala/progscala3/fp/datastructs/FoldRegexPatternsSuite.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FoldRegexPatternsSuite extends FunSuite:
2323
type KV = (String,String)
2424

2525
// Parse each line, skipping expected
26-
val kvPairs =
26+
val actual =
2727
properties.split("\n").
2828
zipWithIndex.
2929
foldLeft(Vector.empty[Either[Error,KV]]) { case (vect, (line, n)) =>
@@ -32,10 +32,11 @@ class FoldRegexPatternsSuite extends FunSuite:
3232
case kvRegex(key, value) => vect :+ Right(key.trim -> value.trim)
3333
case _ => vect :+ Left(n+1, line.trim)
3434
}
35-
assert(kvPairs == Vector(
35+
val expected = Vector(
3636
Right("book.name" -> "Programming Scala, Third Edition"),
3737
Right("book.authors" -> "Dean Wampler"),
3838
Left(6 -> "an unexpected line"),
3939
Right("book.publisher" -> "O'Reilly"),
40-
Right("book.publication-year" -> "2021")))
40+
Right("book.publication-year" -> "2021"))
41+
assert(actual == expected, "Actual:\n$actual\nExpected:\n$expected")
4142
}

0 commit comments

Comments
 (0)