From dd6833ecd44c12ef3b71ae005f180b11d8ccb96e Mon Sep 17 00:00:00 2001 From: Aristos Pasalides Date: Wed, 15 Dec 2021 21:00:29 +0200 Subject: [PATCH] Reverted "Created tests for when debug is false.". This reverts commit 5c96e9b4 (cherry picked from commit 091249cdd549f6f5c0f2916a3cff5907d8a255a1) --- src/test/kotlin/ktee/KTeeTest.kt | 57 -------------------------------- 1 file changed, 57 deletions(-) diff --git a/src/test/kotlin/ktee/KTeeTest.kt b/src/test/kotlin/ktee/KTeeTest.kt index 5502a0b..b9d47d0 100644 --- a/src/test/kotlin/ktee/KTeeTest.kt +++ b/src/test/kotlin/ktee/KTeeTest.kt @@ -4,7 +4,6 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import kotlin.test.Test import kotlin.test.assertEquals -import kotlin.test.assertFailsWith import kotlin.test.assertTrue class KTeeTest { @@ -65,60 +64,4 @@ class KTeeTest { outputs.forEach { assertTrue { it.endsWith("hello myval" + System.lineSeparator()) } } } - @Test - fun `should throw IllegalStateException`() { - assertFailsWith { - KTee.debug = false; KTee.debug = false } - } - - @Test - fun `should not write to stdout`() { - if (!KTee.debugChanged) KTee.debug = false - assertEquals("", trapOut { "myval".tee() }) - } - - @Test - fun `should not evaluate lambda or write to stdout`() { - if (!KTee.debugChanged) KTee.debug = false - assertEquals("", trapOut { "myval".tee { v -> "value is $v" } }) - } - - @Test - fun `should not write to logger`() { - if (!KTee.debugChanged) KTee.debug = false - assertTrue(trapErr { "myval".teeToInfo(logger) } == "") - } - - @Test - fun `should not log with info level`() { - if (!KTee.debugChanged) KTee.debug = false - val outputs = listOf( - trapErr { "myval".teeToInfo(logger, "hello {}") }, - trapErr { "myval".teeToInfo(logger) { "hello $it" } }, - trapErr { "myval".teeToInfo(logger) { "hello {}" } } - ) - outputs.forEach { assertTrue { !it.contains("INFO") } } - } - - @Test - fun `should not log with trace level`() { - if (!KTee.debugChanged) KTee.debug = false - val outputs = listOf( - trapErr { "myval".teeToTrace(logger, "hello {}") }, - trapErr { "myval".teeToTrace(logger) { "hello $it" } }, - trapErr { "myval".teeToTrace(logger) { "hello {}" } } - ) - outputs.forEach { assertTrue { it == "" } } - } - - @Test - fun `should not log with debug level`() { - if (!KTee.debugChanged) KTee.debug = false - val outputs = listOf( - trapErr { "myval".teeToDebug(logger, "hello {}") }, - trapErr { "myval".teeToDebug(logger) { "hello $it" } }, - trapErr { "myval".teeToDebug(logger) { "hello {}" } } - ) - outputs.forEach { assertTrue { !it.contains("DEBUG") } } - } }