Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/test/scala/progscala3/forcomps/RemoveBlanksSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package progscala3.forcomps

import munit.*

import java.lang.System.lineSeparator

class RemoveBlanksSuite extends FunSuite:
var path = "src/test/scala/progscala3/forcomps/small-test-file.txt"

test("RemoveBlanks removes blank lines in text") {
val lines = RemoveBlanks(path, compress = false, numbers = false)
val actual = lines.mkString("\n")
val actual = lines.mkString(lineSeparator)
val expected =
""" This is a small
|test file""".stripMargin
Expand All @@ -17,7 +19,7 @@ class RemoveBlanksSuite extends FunSuite:

test("RemoveBlanks optionally compresses whitespace in text") {
val lines = RemoveBlanks(path, compress = true, numbers = false)
val actual = lines.mkString("\n")
val actual = lines.mkString(lineSeparator)
val expected =
"""This is a small
|test file""".stripMargin
Expand All @@ -26,7 +28,7 @@ class RemoveBlanksSuite extends FunSuite:

test("RemoveBlanks optionally prints line numbers from the original text") {
val lines = RemoveBlanks(path, compress = true, numbers = true)
val actual = lines.mkString("\n")
val actual = lines.mkString(lineSeparator)
val expected =
""" 1: This is a small
| 3: test file""".stripMargin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package progscala3.fp.datastructs

import munit.*

import java.lang.System.lineSeparator

class FoldRegexPatternsSuite extends FunSuite:
test("Regex pattern matching used in a foldLeft") {
val ignoreRegex = """^\s*(#.*|\s*)$""".r // <1>
Expand All @@ -24,7 +26,7 @@ class FoldRegexPatternsSuite extends FunSuite:

// Parse each line, skipping expected
val actual =
properties.split("\n").
properties.split(lineSeparator).
zipWithIndex.
foldLeft(Vector.empty[Either[Error,KV]]) { case (vect, (line, n)) =>
if ignoreRegex.matches(line) then vect
Expand Down