history expect tests: fix the tests.

The colors happening for the interactive tests didn't match the
expected output. For `history search` commands we test, have them
pipe through `cat` so the fishscript does not use a pager or try
to colorize.
This commit is contained in:
Aaron Gyes 2018-11-20 05:26:54 -08:00
parent 007d794b6e
commit fc9d8eec72

View File

@ -50,7 +50,7 @@ expect_prompt -re {start2\r\necho start1; builtin history; echo end1\r\nend2\r\n
# ========== # ==========
# Verify explicit searching for the first two commands in the previous tests # Verify explicit searching for the first two commands in the previous tests
# returns the expected results. # returns the expected results.
send "history search --reverse 'echo start'\r" send "history search --reverse 'echo start' | cat\r"
expect_prompt -re {\r\necho start1;.*\r\necho start2;} { expect_prompt -re {\r\necho start1;.*\r\necho start2;} {
puts "history function explicit search succeeded" puts "history function explicit search succeeded"
} timeout { } timeout {
@ -87,14 +87,14 @@ expect_prompt
send "echo hello AGAIN\r" send "echo hello AGAIN\r"
expect_prompt expect_prompt
send "history search --exact 'echo goodbye'\r" send "history search --exact 'echo goodbye' | cat\r"
expect_prompt -re {\r\necho goodbye\r\n} { expect_prompt -re {\r\necho goodbye\r\n} {
puts "history function explicit exact search 'echo goodbye' succeeded" puts "history function explicit exact search 'echo goodbye' succeeded"
} timeout { } timeout {
puts stderr "history function explicit exact search 'echo goodbye' failed" puts stderr "history function explicit exact search 'echo goodbye' failed"
} }
send "history search --exact 'echo hello'\r" send "history search --exact 'echo hello' | cat\r"
expect_prompt -re {\r\necho hello\r\n} { expect_prompt -re {\r\necho hello\r\n} {
puts "history function explicit exact search 'echo hello' succeeded" puts "history function explicit exact search 'echo hello' succeeded"
} timeout { } timeout {
@ -103,15 +103,15 @@ expect_prompt -re {\r\necho hello\r\n} {
# This is slightly subtle in that it shouldn't actually match anything between # This is slightly subtle in that it shouldn't actually match anything between
# the command we sent and the next prompt. # the command we sent and the next prompt.
send "history search --exact 'echo hell'\r" send "history search --exact 'echo hell' | cat\r"
expect_prompt -re {history search --exact 'echo hell'\r\n} { expect_prompt -re {history search --exact 'echo hell' | cat\r\n} {
puts "history function explicit exact search 'echo hell' succeeded" puts "history function explicit exact search 'echo hell' succeeded"
} timeout { } timeout {
puts stderr "history function explicit exact search 'echo hell' failed" puts stderr "history function explicit exact search 'echo hell' failed"
} }
# Verify that glob searching works. # Verify that glob searching works.
send "history search --prefix 'echo start*echo end'\r" send "history search --prefix 'echo start*echo end' | cat\r"
expect_prompt -re {echo start1; builtin history; echo end1\r\n} { expect_prompt -re {echo start1; builtin history; echo end1\r\n} {
puts "history function explicit glob search 'echo start*echo end' succeeded" puts "history function explicit glob search 'echo start*echo end' succeeded"
} timeout { } timeout {