2017-08-18 19:10:05 +02:00
|
|
|
shared_examples 'special characters' do
|
2020-05-07 07:36:22 +02:00
|
|
|
describe 'a special character in the buffer should be treated like any other character' do
|
|
|
|
it 'asterisk' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo "hello*"', 'echo "hello."') do
|
|
|
|
session.send_string('echo "hello*')
|
|
|
|
wait_for { session.content }.to eq('echo "hello*"')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'question mark' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo "hello?"', 'echo "hello."') do
|
|
|
|
session.send_string('echo "hello?')
|
|
|
|
wait_for { session.content }.to eq('echo "hello?"')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'backslash' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo "hello\nworld"') do
|
|
|
|
session.send_string('echo "hello\\')
|
|
|
|
wait_for { session.content }.to eq('echo "hello\nworld"')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'double backslash' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo "\\\\"') do
|
|
|
|
session.send_string('echo "\\\\')
|
|
|
|
wait_for { session.content }.to eq('echo "\\\\"')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'tilde' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo ~/foo') do
|
|
|
|
session.send_string('echo ~')
|
|
|
|
wait_for { session.content }.to eq('echo ~/foo')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'parentheses' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo "$(ls foo)"') do
|
|
|
|
session.send_string('echo "$(')
|
|
|
|
wait_for { session.content }.to eq('echo "$(ls foo)"')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'square bracket' do
|
2017-08-18 19:10:05 +02:00
|
|
|
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
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'octothorpe' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo "#yolo"') do
|
|
|
|
session.send_string('echo "#')
|
|
|
|
wait_for { session.content }.to eq('echo "#yolo"')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'caret' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('echo "^A"', 'echo "^B"') do
|
|
|
|
session.send_string('echo "^A')
|
|
|
|
wait_for { session.content }.to eq('echo "^A"')
|
|
|
|
end
|
2020-05-07 07:36:22 +02:00
|
|
|
end
|
2017-08-18 19:10:05 +02:00
|
|
|
|
2020-05-07 07:36:22 +02:00
|
|
|
it 'dash' do
|
2017-08-18 19:10:05 +02:00
|
|
|
with_history('-foo() {}') do
|
|
|
|
session.send_string('-')
|
|
|
|
wait_for { session.content }.to eq('-foo() {}')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|