-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this PR ensures that the import tests are _strong_. by _strong_, i mean that now, they compare the list of commands in scope before and after the `use` of a given module. the diff, i.e. the new commands in scope, should be exactly the commands from the module. the import tests don't rely on a prefix anymore.
- Loading branch information
Showing
3 changed files
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
export def "assert imports" [ | ||
module: string, submodule: string, expected: list<string>, --prefix: string = "gm " | ||
module: string, submodule: string, expected: list<string> | ||
] { | ||
let src = $" | ||
let before = ^$nu.current-exe --no-config-file --commands " | ||
scope commands | get name | ||
| to nuon | ||
" | from nuon | ||
let after = ^$nu.current-exe --no-config-file --commands $" | ||
use ./src/($module)/ ($submodule) * | ||
scope commands | get name | where \($it | str starts-with '($prefix)'\) | to nuon | ||
" | ||
scope commands | get name | ||
| to nuon" | from nuon | ||
|
||
let actual = ^$nu.current-exe --no-config-file --commands $src | from nuon | ||
assert equal $actual $expected | ||
let imported = $after | where $it not-in $before | ||
|
||
assert equal $imported $expected | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters