Skip to content

Commit 809473e

Browse files
committed
Fold classpath test helper into a fixture
Move the inline Greeter.java source out of ScipBuildToolTest's prepare lambda into a fixture, materialized via copyFixture (now protected).
1 parent 10876d4 commit 809473e

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

tests/buildTools/src/test/kotlin/tests/BuildToolHarness.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ abstract class BuildToolHarness {
113113
* is non-empty, each token is textually replaced in every file, which lets a
114114
* single fixture cover parametrized variants (e.g. the JDK in a toolchain).
115115
*/
116-
private fun copyFixture(
116+
protected fun copyFixture(
117117
fixture: String,
118118
target: Path,
119-
substitutions: Map<String, String>,
119+
substitutions: Map<String, String> = emptyMap(),
120120
) {
121121
val resource = "/fixtures/$fixture"
122122
val url =

tests/buildTools/src/test/kotlin/tests/ScipBuildToolTest.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,8 @@ class ScipBuildToolTest : BuildToolHarness() {
3737
// workspace so its sources are not themselves indexed.
3838
prepare = { workingDirectory ->
3939
val libSrcDir = Files.createTempDirectory("scip-classpath-lib")
40+
copyFixture("scip/compiles-with-classpath-lib", libSrcDir)
4041
val libSrc = libSrcDir.resolve("bar").resolve("Greeter.java")
41-
Files.createDirectories(libSrc.parent)
42-
Files.writeString(
43-
libSrc,
44-
"""
45-
|package bar;
46-
|public class Greeter {
47-
| public String greet() { return "hi"; }
48-
|}
49-
|""".trimMargin(),
50-
)
5142
val libClasses = workingDirectory.resolve("lib-classes")
5243
Files.createDirectories(libClasses)
5344
exec(
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package bar;
2+
public class Greeter {
3+
public String greet() { return "hi"; }
4+
}

0 commit comments

Comments
 (0)