File tree 2 files changed +22
-5
lines changed
build/src/test/scala/scala/build/tests
integration/src/test/scala/scala/cli/integration
2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -8,20 +8,30 @@ import java.util.concurrent.TimeUnit
8
8
import scala .concurrent .duration .FiniteDuration
9
9
10
10
object TestUtil {
11
+
11
12
abstract class ScalaCliBuildSuite extends munit.FunSuite {
13
+ extension (munitContext : BeforeEach | AfterEach ) {
14
+ def locationAbsolutePath : os.Path =
15
+ os.pwd / os.RelPath {
16
+ (munitContext match {
17
+ case beforeEach : BeforeEach => beforeEach.test
18
+ case afterEach : AfterEach => afterEach.test
19
+ }).location.path
20
+ }
21
+ }
12
22
override def munitTimeout = new FiniteDuration (120 , TimeUnit .SECONDS )
13
23
val testStartEndLogger = new Fixture [Unit ](" files" ) {
14
24
def apply (): Unit = ()
15
25
16
26
override def beforeEach (context : BeforeEach ): Unit = {
17
- val fileName = os. Path ( context.test.location.path) .baseName
27
+ val fileName = context.locationAbsolutePath .baseName
18
28
System .err.println(
19
29
s " >==== ${Console .CYAN }Running ' ${context.test.name}' from $fileName${Console .RESET }"
20
30
)
21
31
}
22
32
23
33
override def afterEach (context : AfterEach ): Unit = {
24
- val fileName = os. Path ( context.test.location.path) .baseName
34
+ val fileName = context.locationAbsolutePath .baseName
25
35
System .err.println(
26
36
s " X==== ${Console .CYAN }Finishing ' ${context.test.name}' from $fileName${Console .RESET }"
27
37
)
Original file line number Diff line number Diff line change @@ -5,18 +5,25 @@ import java.util.concurrent.TimeUnit
5
5
import scala .concurrent .duration .{Duration , FiniteDuration }
6
6
7
7
abstract class ScalaCliSuite extends munit.FunSuite {
8
- val testStartEndLogger = new Fixture [Unit ](" files" ) {
8
+ implicit class BeforeEachOpts (munitContext : BeforeEach ) {
9
+ def locationAbsolutePath : os.Path = os.pwd / os.RelPath (munitContext.test.location.path)
10
+ }
11
+
12
+ implicit class AfterEachOpts (munitContext : AfterEach ) {
13
+ def locationAbsolutePath : os.Path = os.pwd / os.RelPath (munitContext.test.location.path)
14
+ }
15
+ val testStartEndLogger : Fixture [Unit ] = new Fixture [Unit ](" files" ) {
9
16
def apply (): Unit = ()
10
17
11
18
override def beforeEach (context : BeforeEach ): Unit = {
12
- val fileName = os. Path ( context.test.location.path) .baseName
19
+ val fileName = context.locationAbsolutePath .baseName
13
20
System .err.println(
14
21
s " >==== ${Console .CYAN }Running ' ${context.test.name}' from $fileName${Console .RESET }"
15
22
)
16
23
}
17
24
18
25
override def afterEach (context : AfterEach ): Unit = {
19
- val fileName = os. Path ( context.test.location.path) .baseName
26
+ val fileName = context.locationAbsolutePath .baseName
20
27
System .err.println(
21
28
s " X==== ${Console .CYAN }Finishing ' ${context.test.name}' from $fileName${Console .RESET }"
22
29
)
You can’t perform that action at this time.
0 commit comments