Fix flaky special char specs by not using `with_history` twice per test
There's something funny occasionally happening when `with_history` is used twice in the same test. It seems to be happening more frequently since asynchronous mode was enabled by default. My guess is it has something to do with the `C-c` keys being sent toward the end not consistently terminating the prompt. But I'm really not sure how it would ever get into a `then` block like it seems to: ``` Failure/Error: wait_for { session.content }.to eq('echo "hello\nworld"') expected: "echo \"hello\\nworld\"" got: "then> echo \"hello\\" ``` Sticking to only one `with_history` per terminal session (per test) seems to fix the flakiness. I also removed an old test case because I could not understand why it was necessary and so couldn't write a good description for it. Could be we'll need to add it back in at some point.
This commit is contained in:
parent
e715ffb1ae
commit
05f22fa8a3
|
@ -1,58 +1,71 @@
|
|||
shared_examples 'special characters' do
|
||||
describe 'a special character in the buffer' do
|
||||
it 'should be treated like any other character' do
|
||||
describe 'a special character in the buffer should be treated like any other character' do
|
||||
it 'asterisk' do
|
||||
with_history('echo "hello*"', 'echo "hello."') do
|
||||
session.send_string('echo "hello*')
|
||||
wait_for { session.content }.to eq('echo "hello*"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'question mark' do
|
||||
with_history('echo "hello?"', 'echo "hello."') do
|
||||
session.send_string('echo "hello?')
|
||||
wait_for { session.content }.to eq('echo "hello?"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'backslash' do
|
||||
with_history('echo "hello\nworld"') do
|
||||
session.send_string('echo "hello\\')
|
||||
wait_for { session.content }.to eq('echo "hello\nworld"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'double backslash' do
|
||||
with_history('echo "\\\\"') do
|
||||
session.send_string('echo "\\\\')
|
||||
wait_for { session.content }.to eq('echo "\\\\"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'tilde' do
|
||||
with_history('echo ~/foo') do
|
||||
session.send_string('echo ~')
|
||||
wait_for { session.content }.to eq('echo ~/foo')
|
||||
end
|
||||
end
|
||||
|
||||
it 'parentheses' do
|
||||
with_history('echo "$(ls foo)"') do
|
||||
session.send_string('echo "$(')
|
||||
wait_for { session.content }.to eq('echo "$(ls foo)"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'square bracket' do
|
||||
with_history('echo "$history[123]"') do
|
||||
session.send_string('echo "$history[')
|
||||
wait_for { session.content }.to eq('echo "$history[123]"')
|
||||
session.send_string('123]')
|
||||
wait_for { session.content }.to eq('echo "$history[123]"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'octothorpe' do
|
||||
with_history('echo "#yolo"') do
|
||||
session.send_string('echo "#')
|
||||
wait_for { session.content }.to eq('echo "#yolo"')
|
||||
end
|
||||
end
|
||||
|
||||
with_history('echo "#foo"', 'echo $#abc') do
|
||||
session.send_string('echo "#')
|
||||
wait_for { session.content }.to eq('echo "#foo"')
|
||||
end
|
||||
|
||||
it 'caret' do
|
||||
with_history('echo "^A"', 'echo "^B"') do
|
||||
session.send_string('echo "^A')
|
||||
wait_for { session.content }.to eq('echo "^A"')
|
||||
end
|
||||
end
|
||||
|
||||
it 'dash' do
|
||||
with_history('-foo() {}') do
|
||||
session.send_string('-')
|
||||
wait_for { session.content }.to eq('-foo() {}')
|
||||
|
|
Loading…
Reference in New Issue