mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-09 07:05:08 +02:00
Initial working version of control-r search
This commit is contained in:
@ -144,6 +144,7 @@ func TestParameterized(t *testing.T) {
|
||||
t.Run("testLocalRedaction/"+tester.ShellName(), func(t *testing.T) { testLocalRedaction(t, tester) })
|
||||
t.Run("testRemoteRedaction/"+tester.ShellName(), func(t *testing.T) { testRemoteRedaction(t, tester) })
|
||||
t.Run("testMultipleUsers/"+tester.ShellName(), func(t *testing.T) { testMultipleUsers(t, tester) })
|
||||
t.Run("testConfigGetSet/"+tester.ShellName(), func(t *testing.T) { testConfigGetSet(t, tester) })
|
||||
// TODO: Add a test for multi-line history entries
|
||||
}
|
||||
}
|
||||
@ -1545,6 +1546,32 @@ ls /tmp`, randomCmdUuid, randomCmdUuid)
|
||||
}
|
||||
}
|
||||
|
||||
func testConfigGetSet(t *testing.T, tester shellTester) {
|
||||
// Setup
|
||||
defer shared.BackupAndRestore(t)()
|
||||
installHishtory(t, tester, "")
|
||||
|
||||
// Initially is false
|
||||
out := tester.RunInteractiveShell(t, `hishtory config-get enable-control-r`)
|
||||
if out != "false" {
|
||||
t.Fatalf("unexpected config-get output: %#v", out)
|
||||
}
|
||||
|
||||
// Set to true and check
|
||||
tester.RunInteractiveShell(t, `hishtory config-set enable-control-r true`)
|
||||
out = tester.RunInteractiveShell(t, `hishtory config-get enable-control-r`)
|
||||
if out != "true" {
|
||||
t.Fatalf("unexpected config-get output: %#v", out)
|
||||
}
|
||||
|
||||
// Set to false and check
|
||||
tester.RunInteractiveShell(t, `hishtory config-set enable-control-r false`)
|
||||
out = tester.RunInteractiveShell(t, `hishtory config-get enable-control-r`)
|
||||
if out != "false" {
|
||||
t.Fatalf("unexpected config-get output: %#v", out)
|
||||
}
|
||||
}
|
||||
|
||||
type deviceSet struct {
|
||||
deviceMap *map[device]deviceOp
|
||||
currentDevice *device
|
||||
|
Reference in New Issue
Block a user