Skip to content

Commit

Permalink
More test fixes for tcell on GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Feb 1, 2024
1 parent 413c66b commit 2a1e5a9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
permissions:
contents: read

env:
LANG: C.UTF-8

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -42,7 +45,7 @@ jobs:
run: make test

- name: Integration test
run: make install && ./install --all && LC_ALL=C tmux new-session -d && ruby test/test_go.rb --verbose
run: make install && ./install --all && tmux new-session -d && ruby test/test_go.rb --verbose

- name: Integration test (tcell)
run: TAGS=tcell make clean install && ruby test/test_go.rb --verbose
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ CHANGELOG

0.46.1
------
- Bug fixes and improvements
- Fixed Windows binaries
- Downgraded Go version to 1.20 to support older versions of Windows
- https://tip.golang.org/doc/go1.21#windows
- Updated [rivo/uniseg](https://github.com/rivo/uniseg) dependency to v0.4.5
- Updated [rivo/uniseg](https://github.com/rivo/uniseg) dependency to v0.4.6

0.46.0
------
Expand Down
21 changes: 14 additions & 7 deletions test/test_go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ def test_execute
opts = %[--bind "alt-a:execute(echo /{}/ >> #{output})+change-header(alt-a),alt-b:execute[echo /{}{}/ >> #{output}]+change-header(alt-b),C:execute(echo /{}{}{}/ >> #{output})+change-header(C)"]
writelines(tempname, %w[foo'bar foo"bar foo$bar])
tmux.send_keys "cat #{tempname} | #{fzf(opts)}", :Enter
tmux.until { |lines| assert_equal 3, lines.item_count }

ready = ->(s) { tmux.until { |lines| assert_includes lines[-3], s } }
tmux.send_keys :Escape, :a
Expand Down Expand Up @@ -2184,22 +2185,23 @@ def test_preview_window_follow
file = Tempfile.new('fzf-follow')
file.sync = true

tmux.send_keys %(seq 100 | #{FZF} --preview 'tail -f "#{file.path}"' --preview-window follow --bind 'up:preview-up,down:preview-down,space:change-preview-window:follow|nofollow' --preview-window '~3'), :Enter
tmux.send_keys %(seq 100 | #{FZF} --preview 'echo start; tail -f "#{file.path}"' --preview-window follow --bind 'up:preview-up,down:preview-down,space:change-preview-window:follow|nofollow' --preview-window '~4'), :Enter
tmux.until { |lines| lines.item_count == 100 }

# Write to the temporary file, and check if the preview window is showing
# the last line of the file
tmux.until { |lines| assert_includes lines[1], 'start' }
3.times { file.puts _1 } # header lines
1000.times { file.puts _1 }
tmux.until { |lines| assert_includes lines[1], '/1003' }
tmux.until { |lines| assert_includes lines[1], '/1004' }
tmux.until { |lines| assert_includes lines[-2], '999' }

# Scroll the preview window and fzf should stop following the file content
tmux.send_keys :Up
tmux.until { |lines| assert_includes lines[-2], '998' }
file.puts 'foo', 'bar'
tmux.until do |lines|
assert_includes lines[1], '/1005'
assert_includes lines[1], '/1006'
assert_includes lines[-2], '998'
end

Expand All @@ -2212,7 +2214,7 @@ def test_preview_window_follow
end
file.puts 'baz'
tmux.until do |lines|
assert_includes lines[1], '/1006'
assert_includes lines[1], '/1007'
assert_includes lines[-2], 'baz'
end

Expand All @@ -2221,7 +2223,7 @@ def test_preview_window_follow
wait { assert_includes lines[-2], 'bar' }
file.puts 'aaa'
tmux.until do |lines|
assert_includes lines[1], '/1007'
assert_includes lines[1], '/1008'
assert_includes lines[-2], 'bar'
end

Expand All @@ -2230,15 +2232,15 @@ def test_preview_window_follow
tmux.until { |lines| assert_includes lines[-2], 'aaa' }
file.puts 'bbb'
tmux.until do |lines|
assert_includes lines[1], '/1008'
assert_includes lines[1], '/1009'
assert_includes lines[-2], 'bbb'
end

# Disable following
tmux.send_keys :Space
file.puts 'ccc', 'ddd'
tmux.until do |lines|
assert_includes lines[1], '/1010'
assert_includes lines[1], '/1011'
assert_includes lines[-2], 'bbb'
end
rescue StandardError
Expand Down Expand Up @@ -3080,6 +3082,11 @@ def test_reload_and_change_cache
end

def test_delete_with_modifiers
if ENV['GITHUB_ACTION']
# Expected: "[3]"
# Actual: "[]3;5~"
skip('CTRL-DELETE is not properly handled in GitHub Actions environment')
end
tmux.send_keys "seq 100 | #{FZF} --bind 'ctrl-delete:up+up,shift-delete:down,focus:transform-prompt:echo [{}]'", :Enter
tmux.until { |lines| assert_equal 100, lines.item_count }
tmux.send_keys 'C-Delete'
Expand Down

0 comments on commit 2a1e5a9

Please sign in to comment.