mirror of
https://github.com/sbrow/envr.git
synced 2026-08-26 09:53:32 -04:00
feat: Improved nushell wrapper output.
This commit is contained in:
@@ -7,31 +7,72 @@ import "core:testing"
|
||||
|
||||
@(test)
|
||||
test_nushell_completion_nonempty :: proc(t: ^testing.T) {
|
||||
testing.expect(t, len(COMPLETION_SCRIPT) > 0, "completion script should not be empty")
|
||||
script := generate_nushell_completion()
|
||||
testing.expect(t, len(script) > 0, "completion script should not be empty")
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_nushell_completion_contains_externs :: proc(t: ^testing.T) {
|
||||
test_nushell_completion_contains_commands :: proc(t: ^testing.T) {
|
||||
script := generate_nushell_completion()
|
||||
expected := []string{
|
||||
"tracked-paths",
|
||||
"untracked-paths",
|
||||
"envr backup",
|
||||
"envr check",
|
||||
"envr edit-config",
|
||||
"envr help",
|
||||
"envr init",
|
||||
"envr list",
|
||||
"envr remove",
|
||||
"envr restore",
|
||||
"envr scan",
|
||||
"envr sync",
|
||||
"envr version",
|
||||
"envr nushell-completion",
|
||||
}
|
||||
for ext in expected {
|
||||
testing.expect(
|
||||
t,
|
||||
strings.contains(COMPLETION_SCRIPT, ext),
|
||||
strings.contains(script, ext),
|
||||
fmt.tprintf("expected script to contain %q", ext),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_nushell_completion_contains_flags :: proc(t: ^testing.T) {
|
||||
script := generate_nushell_completion()
|
||||
expected_flags := []string{
|
||||
"--help(-h)",
|
||||
"--config-file(-c)",
|
||||
"--color",
|
||||
"--force(-f)",
|
||||
"--output(-o)",
|
||||
}
|
||||
for flag in expected_flags {
|
||||
testing.expect(
|
||||
t,
|
||||
strings.contains(script, flag),
|
||||
fmt.tprintf("expected script to contain %q", flag),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_nushell_completion_contains_aliases :: proc(t: ^testing.T) {
|
||||
script := generate_nushell_completion()
|
||||
testing.expect(
|
||||
t,
|
||||
strings.contains(script, "envr add"),
|
||||
"expected script to contain 'envr add' alias",
|
||||
)
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_nushell_completion_no_help_command :: proc(t: ^testing.T) {
|
||||
script := generate_nushell_completion()
|
||||
testing.expect(
|
||||
t,
|
||||
!strings.contains(script, "envr help"),
|
||||
"script should not contain 'envr help' (not a real command)",
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user