Skip to content

Commit

Permalink
Reproduce slf4j issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Dec 13, 2024
1 parent 7019344 commit bb3fc4f
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions launcher/src/test/scala/LauncherTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package testpkg

import giter8._
import verify._
import java.io.File
import java.io.{ByteArrayOutputStream, File, PrintStream}
import sbt.io.IO

object LauncherTest extends BasicTestSuite {
Expand All @@ -22,12 +22,30 @@ object LauncherTest extends BasicTestSuite {
}
}

/*
test("runs [email protected]:scala/scala-seed.g8.git") {
IO.withTemporaryDirectory { dir =>
launcher.run(Array("[email protected]:scala/scala-seed.g8.git", "--name=hello"), dir)
assert((dir / "hello" / "build.sbt").exists)
test("log scala/scala-seed.g8") {
val (r, err) = withErr {
IO.withTemporaryDirectory { dir =>
launcher.run(Array("scala/scala-seed.g8", "--name=hello"), dir)
assert((dir / "hello" / "build.sbt").exists)
}
}
assert(!err.contains("SLF4J"))
}
*/

def withErr[A1](f: => A1): (A1, String) = {
val originalErr = System.err
val byteArrayOutputStream = new ByteArrayOutputStream()
val inMemoryPrintStream = new PrintStream(byteArrayOutputStream)
val result =
try {
System.setErr(inMemoryPrintStream)
val r = f
inMemoryPrintStream.flush()
r
} finally {
System.setErr(originalErr)
}
(result, byteArrayOutputStream.toString)
}

}

0 comments on commit bb3fc4f

Please sign in to comment.