소스 검색

Merge pull request #530 from zsh-users/fixes/flaky-ci

Fixes/flaky ci
pull/555/head
Eric Freese 4 년 전
committed by GitHub
부모
커밋
eff0894a13
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
3개의 변경된 파일32개의 추가작업 그리고 21개의 파일을 삭제
  1. +1
    -6
      spec/multi_line_spec.rb
  2. +11
    -8
      spec/spec_helper.rb
  3. +20
    -7
      spec/strategies/special_characters_helper.rb

+ 1
- 6
spec/multi_line_spec.rb 파일 보기

@ -1,11 +1,6 @@
describe 'a multi-line suggestion' do
it 'should be displayed on multiple lines' do
with_history(-> {
session.send_string('echo "')
session.send_keys('enter')
session.send_string('"')
session.send_keys('enter')
}) do
with_history("echo \"\n\"") do
session.send_keys('e')
wait_for { session.content }.to eq("echo \"\n\"")
end

+ 11
- 8
spec/spec_helper.rb 파일 보기

@ -1,6 +1,7 @@
require 'pry'
require 'rspec/wait'
require 'terminal_session'
require 'tempfile'
RSpec.shared_context 'terminal session' do
let(:term_opts) { {} }
@ -21,18 +22,20 @@ RSpec.shared_context 'terminal session' do
end
def with_history(*commands, &block)
session.run_command('fc -p')
Tempfile.create do |f|
f.write(commands.map{|c| c.gsub("\n", "\\\n")}.join("\n"))
f.flush
commands.each do |c|
c.respond_to?(:call) ? c.call : session.run_command(c)
end
session.run_command('fc -p')
session.run_command("fc -R #{f.path}")
session.clear_screen
session.clear_screen
yield block
yield block
session.send_keys('C-c')
session.run_command('fc -P')
session.send_keys('C-c')
session.run_command('fc -P')
end
end
end

+ 20
- 7
spec/strategies/special_characters_helper.rb 파일 보기

@ -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() {}')

불러오는 중...
취소
저장