Improve installer updates and dependency checks and add command aliases
Release / release (push) Successful in 7m57s
Release / release (push) Successful in 7m57s
This commit is contained in:
1 parent
12cc64fdd9
commit
4b28d441b0
13 files changed
+973
-148
No files matched your search
@@ -157,3 +157,23 @@ func TestEnvironmentOverridesWithoutConfigKeys(t *testing.T) {
|
||||
t.Fatalf("env ignored: %+v", cfg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandAliasEnvironmentAndValidation(t *testing.T) {
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
t.Setenv("NETSSH_SHELL_ALIAS", "j")
|
||||
cfg, err := Load()
|
||||
if err != nil || cfg.Shell.Alias != "j" {
|
||||
t.Fatalf("alias env: %+v, %v", cfg, err)
|
||||
}
|
||||
for _, name := range []string{"netssh", "if", "alias", "j;touch /tmp/bad", "a b", "1bad"} {
|
||||
t.Setenv("NETSSH_SHELL_ALIAS", name)
|
||||
if _, err := Load(); err == nil {
|
||||
t.Errorf("unsafe alias accepted: %q", name)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"", "j", "jump_server", "goSSH"} {
|
||||
if err := ValidateCommandAlias(name); err != nil {
|
||||
t.Errorf("valid alias rejected: %s: %v", name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user