From 090c989656d672644161aac5da97266161e59458 Mon Sep 17 00:00:00 2001 From: Akiyoshi Suda Date: Sat, 2 May 2026 17:18:46 +0900 Subject: [PATCH] gnu: emacs-agent-shell: Add tests. * gnu/packages/patches/emacs-agent-shell-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Record it. * gnu/packages/emacs-xyz (emacs-agent-shell)[source]: Register it. [arguments]: Add #:test command. [native-inputs]: Add emacs-ert-runner. Merges guix/guix!8197 Change-Id: If451a42bf65e534b4dbdce025a47c31ad548cf1a Signed-off-by: Cayetano Santos Modified-by: Cayetano Santos --- gnu/local.mk | 1 + gnu/packages/emacs-xyz.scm | 13 +++++++- .../patches/emacs-agent-shell-fix-tests.patch | 32 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/emacs-agent-shell-fix-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index cb848261e41..e742b8b9393 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1242,6 +1242,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-treelib-remove-python2-compat.patch \ %D%/packages/patches/elm-offline-package-registry.patch \ %D%/packages/patches/elm-reactor-static-files.patch \ + %D%/packages/patches/emacs-agent-shell-fix-tests.patch \ %D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \ %D%/packages/patches/emacs-disable-jit-compilation.patch \ %D%/packages/patches/emacs-doc-toc-shell-commands.patch \ diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index c7202e2721d..25158f4c43d 100644 --- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm @@ -1246,8 +1246,19 @@ communicating with LLM agents.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0njajpz51pbz4hqaq7lcvwaypilq1c9sdxsk6sdxgk1xpivqlxfb")))) + (base32 "0njajpz51pbz4hqaq7lcvwaypilq1c9sdxsk6sdxgk1xpivqlxfb")) + (patches + (search-patches "emacs-agent-shell-fix-tests.patch")))) (build-system emacs-build-system) + (arguments (list #:test-command + #~(list "ert-runner" "tests" + "-l" "tests/agent-shell-anthropic-tests.el" + "-l" "tests/agent-shell-command-prefix-tests.el" + "-l" "tests/agent-shell-devcontainer-tests.el" + "-l" "tests/agent-shell-diff-tests.el" + "-l" "tests/agent-shell-openai-tests.el" + "-l" "tests/agent-shell-tests.el"))) + (native-inputs (list emacs-ert-runner)) (propagated-inputs (list emacs-shell-maker emacs-acp)) (home-page "https://github.com/xenodium/agent-shell") (synopsis "Native agentic integrations for Claude Code, Gemini CLI, etc") diff --git a/gnu/packages/patches/emacs-agent-shell-fix-tests.patch b/gnu/packages/patches/emacs-agent-shell-fix-tests.patch new file mode 100644 index 00000000000..3e0dea12df8 --- /dev/null +++ b/gnu/packages/patches/emacs-agent-shell-fix-tests.patch @@ -0,0 +1,32 @@ +From 158304fb31177304d41fe495f8c1cca1fb5cff70 Mon Sep 17 00:00:00 2001 +From: xenodium <8107219+xenodium@users.noreply.github.com> +Date: Wed, 25 Mar 2026 12:37:17 +0000 +Subject: [PATCH] Fixing test + +--- + tests/agent-shell-tests.el | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tests/agent-shell-tests.el b/tests/agent-shell-tests.el +index f602912d..9263e051 100644 +--- a/tests/agent-shell-tests.el ++++ b/tests/agent-shell-tests.el +@@ -1233,14 +1233,16 @@ code block content + test-buffer)) + ((symbol-function 'shell-maker--process) (lambda () fake-process)) + ((symbol-function 'shell-maker-finish-output) #'ignore) ++ ((symbol-function 'agent-shell--handle) #'ignore) + (agent-shell-file-completion-enabled nil)) + (let* ((shell-buffer (agent-shell--start :config config + :no-focus t + :new-session t)) + (subs (map-elt (buffer-local-value 'agent-shell--state shell-buffer) + :event-subscriptions))) +- (should (= 1 (length subs))) +- (should (eq 'turn-complete (map-elt (car subs) :event)))))) ++ (should (seq-find (lambda (sub) ++ (eq 'turn-complete (map-elt sub :event))) ++ subs))))) + (remove-hook 'agent-shell-mode-hook hook-fn) + (when (process-live-p fake-process) + (delete-process fake-process))