Skip to content

Commit aae74ae

Browse files
committed
Regex fix
1 parent 594b695 commit aae74ae

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

munit/shared/src/main/scala-3/munit/internal/MacroCompat.scala

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ import scala.quoted._
66
import scala.language.experimental.macros
77

88
object MacroCompat {
9-
private val workingDirectory: String =
10-
sys.props("user.dir") + java.io.File.separator
9+
private val workingDirectory: String = {
10+
val sep = java.io.File.separator
11+
val cwd = sys.props("user.dir")
12+
if (cwd.endsWith(sep)) cwd
13+
else cwd + sep
14+
}
1115

1216
trait LocationMacro {
1317
inline implicit def generate: Location = ${ locationImpl() }

munit/shared/src/main/scala/munit/internal/console/Lines.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class Lines extends Serializable {
2323
val somePath1 =
2424
if (somePath.endsWith(sep)) somePath.dropRight(sep.length)
2525
else somePath
26-
somePath1.split(sep).dropRight(1).mkString(sep)
26+
val sep1 =
27+
if (sep == "\\") "\\\\"
28+
else sep
29+
somePath1.split(sep1).dropRight(1).mkString(sep)
2730
}
2831
if (Files.exists(p)) p
2932
else if (max < 1) sys.error(s"$path was not found")

0 commit comments

Comments
 (0)