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
@@ -261,3 +261,30 @@ func writeProfile(t *testing.T, content string) string {
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func TestManagedBlockInstallAndUninstall(t *testing.T) {
|
||||
original := "export KEEP=yes\n# netssh shell-init documentation\necho 'netssh shell-init'\n"
|
||||
profile := writeProfile(t, original+hook.BlockStart+"\nexport PATH='/custom/bin':\"$PATH\"\n'/custom/bin/netssh' shell-init\n[ ! -f '/custom/cache/netssh/aliases.sh' ] || . '/custom/cache/netssh/aliases.sh'\n"+hook.BlockEnd+"\n")
|
||||
if installed, err := hook.Install(profile); err != nil || installed {
|
||||
t.Fatalf("duplicate install: %v, %v", installed, err)
|
||||
}
|
||||
if installed, err := hook.InstallAliasesSource(profile); err != nil || installed {
|
||||
t.Fatalf("duplicate source: %v, %v", installed, err)
|
||||
}
|
||||
if removed, err := hook.Uninstall(profile); err != nil || !removed {
|
||||
t.Fatalf("uninstall: %v, %v", removed, err)
|
||||
}
|
||||
data, _ := os.ReadFile(profile)
|
||||
if string(data) != original {
|
||||
t.Fatalf("unrelated content changed: %s", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProfilePathRespectsZdotdir(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
t.Setenv("ZDOTDIR", dir)
|
||||
path, err := hook.ProfilePath("zsh")
|
||||
if err != nil || path != filepath.Join(dir, ".zshrc") {
|
||||
t.Fatalf("zsh path: %s, %v", path, err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user