mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-29 00:11:50 +02:00
Add control-r tests for searching with simple queries
This commit is contained in:
parent
865fa879fe
commit
2c5a46565c
@ -1725,12 +1725,12 @@ func captureTerminalOutput(t *testing.T, tester shellTester, commands []string)
|
||||
if tester.ShellName() == "bash" {
|
||||
fullCommand += " tmux send -t foo source SPACE ~/.bashrc ENTER\n"
|
||||
}
|
||||
fullCommand += " sleep 0.5\n"
|
||||
fullCommand += " sleep 0.1\n"
|
||||
for _, cmd := range commands {
|
||||
fullCommand += " tmux send -t foo "
|
||||
fullCommand += cmd
|
||||
fullCommand += "\n"
|
||||
fullCommand += " sleep 0.5\n"
|
||||
fullCommand += " sleep 0.1\n"
|
||||
}
|
||||
fullCommand += " tmux capture-pane -p\n"
|
||||
fullCommand += " tmux kill-session -t foo\n"
|
||||
@ -1811,6 +1811,18 @@ func testControlR(t *testing.T, tester shellTester) {
|
||||
if !strings.Contains(out, "echo 'aaaaaa bbbb'\naaaaaa bbbb\n") {
|
||||
t.Fatalf("hishtory tquery executed the wrong result, out=%#v", out)
|
||||
}
|
||||
|
||||
// Search for something more specific and select it
|
||||
out = captureTerminalOutput(t, tester, []string{"C-R", "foo", "Enter"})
|
||||
if !strings.HasSuffix(out, " ls ~/foo/") {
|
||||
t.Fatalf("hishtory tquery returned the wrong result, out=%#v", out)
|
||||
}
|
||||
|
||||
// Search for something more specific, and then unsearch, and then search for something else
|
||||
out = captureTerminalOutput(t, tester, []string{"C-R", "fo", "BSpace BSpace", "bar", "Down", "Enter"})
|
||||
if !strings.HasSuffix(out, " ls ~/bar/") {
|
||||
t.Fatalf("hishtory tquery returned the wrong result, out=%#v", out)
|
||||
}
|
||||
}
|
||||
|
||||
type deviceSet struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user