mirror of
https://github.com/nushell/nushell
synced 2025-01-02 16:29:00 +00:00
d74a260883
# Description Was original asked here: https://github.com/nushell/nushell/pull/8405#issuecomment-1465062652 Make it easier to extend standard library with submodules. (For a new submodule called `xx.nu` the tests can be written in `test_xx.nu`). Test discovery is implemented. # User-Facing Changes There are no user-facing changes. # Tests + Formatting Tests are updated. There is no `nufmt` now. --------- Co-authored-by: Mate Farkas <Mate.Farkas@oneidentity.com>
19 lines
699 B
Text
19 lines
699 B
Text
def main [] {
|
|
for test_file in (ls ($env.FILE_PWD | path join "test_*.nu") -f | get name) {
|
|
let $module_name = ($test_file | path parse).stem
|
|
|
|
echo $"(ansi default)INFO Run tests in ($module_name)(ansi reset)"
|
|
let tests = (
|
|
nu -c $'use ($test_file) *; $nu.scope.commands | to nuon'
|
|
| from nuon
|
|
| where module_name == $module_name
|
|
| where ($it.name | str starts-with "test_")
|
|
| get name
|
|
)
|
|
|
|
for test_case in $tests {
|
|
echo $"(ansi default_dimmed)DEBUG Run test ($module_name)/($test_case)(ansi reset)"
|
|
nu -c $'use ($test_file) ($test_case); ($test_case)'
|
|
}
|
|
}
|
|
}
|