mirror of
https://github.com/nushell/nushell.git
synced 2024-12-04 22:33:50 +01:00
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>
31 lines
657 B
Plaintext
31 lines
657 B
Plaintext
use std log
|
|
use std assert
|
|
|
|
def before-each [] {
|
|
log debug "Setup is running"
|
|
{msg: "This is the context"}
|
|
}
|
|
|
|
def after-each [] {
|
|
log debug $"Teardown is running. Context: ($in)"
|
|
}
|
|
|
|
def test_assert_pass [] {
|
|
log debug $"Assert is running. Context: ($in)"
|
|
}
|
|
|
|
def test_assert_skip [] {
|
|
log debug $"Assert is running. Context: ($in)"
|
|
assert skip
|
|
}
|
|
|
|
def test_assert_fail_skipped_by_default [] {
|
|
assert skip # Comment this line if you want to see what happens if a test fails
|
|
log debug $"Assert is running. Context: ($in)"
|
|
assert false
|
|
}
|
|
|
|
def unrelated [] {
|
|
log error "This should not run"
|
|
}
|