Skip to content

Commit

Permalink
fix compiler plugin test
Browse files Browse the repository at this point in the history
  • Loading branch information
lbialy committed Oct 1, 2024
1 parent 1fdee2b commit c78eece
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions integration-tests/CompilerPlugin.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class CompilerPluginTest extends munit.FunSuite {
override val munitTimeout = 1.minute

test("compilation should fail with pulumi compiler plugin when using output parameter in an s interpolator") {
val result = scalaCli
.compile(os.pwd / "integration-tests" / "resources" / "compiler-plugin")
.call(cwd = os.pwd, check = false, mergeErrIntoOut = true)
val path = os.pwd / "integration-tests" / "resources" / "compiler-plugin"
pulumi.fixture.setupProject(path)
val result = scalaCli.compile(path).call(cwd = os.pwd, check = false, mergeErrIntoOut = true)
val output = result.out.text()
assert(output.contains("is used in a default string interpolator."), clue = output)
assertEquals(result.exitCode, 1)
Expand Down
9 changes: 7 additions & 2 deletions integration-tests/integration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ val defaultProjectFile =
|//> using options -java-output-version:$javaVersion -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement
|//> using plugin org.virtuslab::besom-compiler-plugin:$coreVersion
|//> using dep org.virtuslab::besom-core:$coreVersion
|
|//> using repository sonatype:snapshots
|""".stripMargin

def sanitizeName(name: String): String = name.replaceAll("[^a-zA-Z0-9]", "-").toLowerCase().take(40).stripSuffix("-")
Expand Down Expand Up @@ -171,6 +169,13 @@ object pulumi {
)

object fixture {
def setupProject(testDir: os.Path, projectFiles: Map[String, String] = Map("project.scala" -> defaultProjectFile)): Unit =
projectFiles.foreach { case (name, content) =>
val file = testDir / name
println(s"Writing test file: ${file.relativeTo(os.pwd)}")
os.write.over(file, content)
}

def setup(
opts: FixtureOpts,
args: FixtureArgs*
Expand Down

0 comments on commit c78eece

Please sign in to comment.