comparison .zfun/zsh-autosuggestions/spec/async_spec.rb @ 467:e1ce8897030d

zsh: import df6f6f9ff41 of zsh-autosuggestions
author Augie Fackler <raf@durin42.com>
date Mon, 03 Dec 2018 22:37:29 -0500
parents
children
comparison
equal deleted inserted replaced
466:f248cf012d9a 467:e1ce8897030d
1 context 'with asynchronous suggestions enabled' do
2 before do
3 skip 'Async mode not supported below v5.0.8' if session.zsh_version < Gem::Version.new('5.0.8')
4 end
5
6 let(:options) { ["ZSH_AUTOSUGGEST_USE_ASYNC="] }
7
8 describe '`up-line-or-beginning-search`' do
9 let(:before_sourcing) do
10 -> do
11 session.
12 run_command('autoload -U up-line-or-beginning-search').
13 run_command('zle -N up-line-or-beginning-search').
14 send_string('bindkey "').
15 send_keys('C-v').send_keys('up').
16 send_string('" up-line-or-beginning-search').
17 send_keys('enter')
18 end
19 end
20
21 it 'should show previous history entries' do
22 with_history(
23 'echo foo',
24 'echo bar',
25 'echo baz'
26 ) do
27 session.clear_screen
28 3.times { session.send_keys('up') }
29 wait_for { session.content }.to eq("echo foo")
30 end
31 end
32 end
33
34 it 'should not add extra carriage returns before newlines' do
35 session.
36 send_string('echo "').
37 send_keys('escape').
38 send_keys('enter').
39 send_string('"').
40 send_keys('enter')
41
42 session.clear_screen
43
44 session.send_string('echo')
45 wait_for { session.content }.to eq("echo \"\n\"")
46 end
47
48 it 'should treat carriage returns and newlines as separate characters' do
49 session.
50 send_string('echo "').
51 send_keys('C-v').
52 send_keys('enter').
53 send_string('foo"').
54 send_keys('enter')
55
56 session.
57 send_string('echo "').
58 send_keys('control').
59 send_keys('enter').
60 send_string('bar"').
61 send_keys('enter')
62
63 session.clear_screen
64
65 session.
66 send_string('echo "').
67 send_keys('C-v').
68 send_keys('enter')
69
70 wait_for { session.content }.to eq('echo "^Mfoo"')
71 end
72
73 describe 'exiting a subshell' do
74 it 'should not cause error messages to be printed' do
75 session.run_command('$(exit)')
76
77 sleep 1
78
79 expect(session.content).to eq('$(exit)')
80 end
81 end
82 end
83
84