forked from extern/nushell
0bdc362e13
# Description Test runner now performs following actions in order to run tests: * Module file is opened * Public function with random name is added to the source code, this function calls user-specified private function * Modified module file is saved under random name in $nu.temp-path * Modified module file is imported in subprocess, injected function is called by the test runner # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> * Test functions no longer need to be exported * test functions no longer need to reside in separate test_ files * setup and teardown renamed to before-each and after-each respectively * before-all and after-all functions added that run before all tests in given module. This matches the behavior of test runners used by other languages such as JUnit/TestNG or Mocha # Tests + Formatting # After Submitting --------- Co-authored-by: Kamil <skelly37@protonmail.com> Co-authored-by: amtoine <stevan.antoine@gmail.com>
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
use std *
|
|
|
|
def test_env_log_ansi [] {
|
|
assert equal $env.LOG_ANSI.CRITICAL (ansi red_bold)
|
|
assert equal $env.LOG_ANSI.ERROR (ansi red)
|
|
assert equal $env.LOG_ANSI.WARNING (ansi yellow)
|
|
assert equal $env.LOG_ANSI.INFO (ansi default)
|
|
assert equal $env.LOG_ANSI.DEBUG (ansi default_dimmed)
|
|
}
|
|
|
|
def test_env_log_level [] {
|
|
assert equal $env.LOG_LEVEL.CRITICAL 50
|
|
assert equal $env.LOG_LEVEL.ERROR 40
|
|
assert equal $env.LOG_LEVEL.WARNING 30
|
|
assert equal $env.LOG_LEVEL.INFO 20
|
|
assert equal $env.LOG_LEVEL.DEBUG 10
|
|
}
|
|
|
|
def test_env_log_prefix [] {
|
|
assert equal $env.LOG_PREFIX.CRITICAL "CRT"
|
|
assert equal $env.LOG_PREFIX.ERROR "ERR"
|
|
assert equal $env.LOG_PREFIX.WARNING "WRN"
|
|
assert equal $env.LOG_PREFIX.INFO "INF"
|
|
assert equal $env.LOG_PREFIX.DEBUG "DBG"
|
|
}
|
|
|
|
def test_env_log_short_prefix [] {
|
|
assert equal $env.LOG_SHORT_PREFIX.CRITICAL "C"
|
|
assert equal $env.LOG_SHORT_PREFIX.ERROR "E"
|
|
assert equal $env.LOG_SHORT_PREFIX.WARNING "W"
|
|
assert equal $env.LOG_SHORT_PREFIX.INFO "I"
|
|
assert equal $env.LOG_SHORT_PREFIX.DEBUG "D"
|
|
}
|
|
|
|
def test_env_log_format [] {
|
|
assert equal $env.LOG_FORMAT $"%ANSI_START%%DATE%|%LEVEL%|(ansi u)%MSG%%ANSI_STOP%"
|
|
}
|