Skip to content
Myr

zsh foreign test (#4622)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* test(zsh): add test for C-r with foreign commands * ci: make docker command configurable via variable Allows using alternative container runtimes, e.g., DOCKER=podman make docker-test * test(zsh): use unique histfile for foreign commands test * test(zsh): use multi select in foreign test

authored by LangLangBart · committed by GitHub · parent 33d8d51 · Browse files · 2 files+40 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+40 added−4 removed

  • tests:+35 added−0 removed
  • other:+5 added−4 removed

2 files+40 added−4 removed

modified:test/test_shell_integration.rb+35 added
538 unmodified lines
539 tmux.until do |lines|540 assert_equal ['cat <<EOF | wc -c', 'qux thud', 'EOF'], lines[-3..]541 end542 end543544 # NOTE: 'Perl/$history' won't see foreign cmds immediately, unlike 'awk/fc'.545 # Perl passes only because another cmd runs between mocking and triggering C-r546 # https://github.com/junegunn/fzf/issues/4061547 # https://zsh.org/mla/users/2024/msg00692.html548 test_perl_and_awk 'ctrl_r_foreign_commands' do549 histfile = "#{tempname}-foreign-hist"550 tmux.send_keys "HISTFILE=#{histfile}", :Enter551 tmux.prepare552 # SHARE_HISTORY picks up foreign commands; marked with * in fc553 tmux.send_keys 'setopt SHARE_HISTORY', :Enter554 tmux.prepare555 tmux.send_keys 'fzf_cmd_local', :Enter556 tmux.prepare557 # Mock foreign command (for testing only; don't edit your HISTFILE this way)558 tmux.send_keys "echo ': 0:0;fzf_cmd_foreign' >> $HISTFILE", :Enter559 tmux.prepare560 # Verify fc shows foreign command with asterisk561 tmux.send_keys 'fc -rl -1', :Enter562 tmux.until { |lines| assert lines.any? { |l| l.match?(/^\s*\d+\* fzf_cmd_foreign/) } }563 tmux.prepare564 # Test ctrl-r correctly extracts the foreign command565 tmux.send_keys 'C-r'566 tmux.until { |lines| assert_operator lines.match_count, :>, 0 }567 tmux.send_keys '^fzf_cmd_'568 tmux.until { |lines| assert_equal 2, lines.match_count }569 tmux.send_keys :BTab, :BTab570 tmux.until { |lines| assert_includes lines[-2], '(2)' }571 tmux.send_keys :Enter572 tmux.until do |lines|573 assert_equal ['fzf_cmd_foreign', 'fzf_cmd_local'], lines[-2..]574 end575 ensure576 FileUtils.rm_f(histfile)577 end578end579580class TestFish < TestBase581 include TestShell
49 unmodified lines
modified:Makefile+5 added-4 removed
1GO ?= go2DOCKER ?= docker3GOOS ?= $(shell $(GO) env GOOS)45MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))6ROOT_DIR := $(shell dirname $(MAKEFILE))
185 unmodified lines
192 -rm -f bin/fzf193 cp -f target/$(BINARY) bin/fzf194195docker:195 docker build -t fzf-ubuntu .196 docker run -it fzf-ubuntu tmux196 $(DOCKER) build -t fzf-ubuntu .197 $(DOCKER) run -it fzf-ubuntu tmux198199docker-test:199 docker build -t fzf-ubuntu .200 docker run -it fzf-ubuntu200 $(DOCKER) build -t fzf-ubuntu .201 $(DOCKER) run -it fzf-ubuntu202203update:204 $(GO) get -u205 $(GO) mod tidy
2 unmodified lines