Testing how the test errors are displayed in Travis

This commit is contained in:
Yair Morgenstern
2020-09-03 14:03:17 +03:00
parent 4fd82084d8
commit 6de4300cb8
6 changed files with 41 additions and 16 deletions

View File

@ -1,4 +1,5 @@
import com.unciv.build.BuildConfig
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id("java")
@ -11,6 +12,19 @@ java {
tasks {
test {
workingDir = file("../android/assets")
testLogging.debug {
events(
TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
compileJava {

View File

@ -7,12 +7,13 @@ import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.translations.TranslationFileWriter
import com.unciv.models.translations.Translations
import com.unciv.models.translations.eitherSquareBraceRegex
import com.unciv.models.translations.squareBraceRegex
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.io.OutputStream
import java.io.PrintStream
import java.util.*
@RunWith(GdxTestRunner::class)
@ -22,9 +23,19 @@ class TranslationTests {
@Before
fun loadTranslations() {
// Since the ruleset and translation loader have their own output,
// We 'disable' the output stream for their outputs, and only enable it for the twst itself.
val outputChannel = System.out
System.setOut(PrintStream(object : OutputStream() {
override fun write(b: Int) {}
}))
// System.setOut(TextWriter.Null)
// Console(). //(TextWriter.Null);
translations.readAllLanguagesTranslation()
RulesetCache.loadRulesets()
ruleset = RulesetCache.getBaseRuleset()
System.setOut(outputChannel)
// Console.SetOut()
}
@Test