mirror of
https://github.com/ddworken/hishtory.git
synced 2025-01-23 06:38:52 +01:00
Improve backup and restore env function + fix makefile with quotes + remove the zdotdir created file
This commit is contained in:
parent
6017eac4a3
commit
53a417296e
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ test:
|
|||||||
HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 go test -p 1 -timeout 30m ./...
|
HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 go test -p 1 -timeout 30m ./...
|
||||||
|
|
||||||
ftest:
|
ftest:
|
||||||
HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 go test -v -p 1 -run $(FILTER) ./...
|
HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 go test -v -p 1 -run "$(FILTER)" ./...
|
||||||
|
|
||||||
acttest:
|
acttest:
|
||||||
act push -j test -e .github/push_event.json --reuse --container-architecture linux/amd64
|
act push -j test -e .github/push_event.json --reuse --container-architecture linux/amd64
|
||||||
|
@ -2159,6 +2159,7 @@ func TestZDotDir(t *testing.T) {
|
|||||||
}
|
}
|
||||||
os.Setenv("ZDOTDIR", path.Join(homedir, data.HISHTORY_PATH))
|
os.Setenv("ZDOTDIR", path.Join(homedir, data.HISHTORY_PATH))
|
||||||
installHishtory(t, tester, "")
|
installHishtory(t, tester, "")
|
||||||
|
defer os.Remove(path.Join(homedir, data.HISHTORY_PATH, ".zshrc"))
|
||||||
|
|
||||||
// Run a command and check that it was recorded
|
// Run a command and check that it was recorded
|
||||||
tester.RunInteractiveShell(t, `echo foo`)
|
tester.RunInteractiveShell(t, `echo foo`)
|
||||||
|
@ -150,7 +150,11 @@ func copy(src, dst string) error {
|
|||||||
func BackupAndRestoreEnv(k string) func() {
|
func BackupAndRestoreEnv(k string) func() {
|
||||||
origValue := os.Getenv(k)
|
origValue := os.Getenv(k)
|
||||||
return func() {
|
return func() {
|
||||||
os.Setenv(k, origValue)
|
if origValue == "" {
|
||||||
|
os.Unsetenv(k)
|
||||||
|
} else {
|
||||||
|
os.Setenv(k, origValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user