From c8cf0992c18799e7a6e986e536cc0e890ea7e05a Mon Sep 17 00:00:00 2001 From: LangLangBart <92653266+LangLangBart@users.noreply.github.com> Date: Mon, 8 Dec 2025 03:15:44 +0100 Subject: [PATCH] zsh foreign test (#4622) * 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 --- Makefile | 9 +++++---- test/test_shell_integration.rb | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 61261cbe..f073772a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ GO ?= go +DOCKER ?= docker GOOS ?= $(shell $(GO) env GOOS) MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST))) @@ -192,12 +193,12 @@ bin/fzf: target/$(BINARY) | bin cp -f target/$(BINARY) bin/fzf docker: - docker build -t fzf-ubuntu . - docker run -it fzf-ubuntu tmux + $(DOCKER) build -t fzf-ubuntu . + $(DOCKER) run -it fzf-ubuntu tmux docker-test: - docker build -t fzf-ubuntu . - docker run -it fzf-ubuntu + $(DOCKER) build -t fzf-ubuntu . + $(DOCKER) run -it fzf-ubuntu update: $(GO) get -u diff --git a/test/test_shell_integration.rb b/test/test_shell_integration.rb index e98b7017..3589f3ac 100644 --- a/test/test_shell_integration.rb +++ b/test/test_shell_integration.rb @@ -540,6 +540,41 @@ class TestZsh < TestBase assert_equal ['cat <> $HISTFILE", :Enter + tmux.prepare + # Verify fc shows foreign command with asterisk + tmux.send_keys 'fc -rl -1', :Enter + tmux.until { |lines| assert lines.any? { |l| l.match?(/^\s*\d+\* fzf_cmd_foreign/) } } + tmux.prepare + # Test ctrl-r correctly extracts the foreign command + tmux.send_keys 'C-r' + tmux.until { |lines| assert_operator lines.match_count, :>, 0 } + tmux.send_keys '^fzf_cmd_' + tmux.until { |lines| assert_equal 2, lines.match_count } + tmux.send_keys :BTab, :BTab + tmux.until { |lines| assert_includes lines[-2], '(2)' } + tmux.send_keys :Enter + tmux.until do |lines| + assert_equal ['fzf_cmd_foreign', 'fzf_cmd_local'], lines[-2..] + end + ensure + FileUtils.rm_f(histfile) + end end class TestFish < TestBase