emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/bash-completion 6aedd69000 164/313: Delete duplicates when


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 6aedd69000 164/313: Delete duplicates when extracting candidates. fixes #26
Date: Sat, 3 Dec 2022 10:59:27 -0500 (EST)

branch: elpa/bash-completion
commit 6aedd690006e07199b2fcd319b9b840a527650e5
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>

    Delete duplicates when extracting candidates. fixes #26
---
 bash-completion.el           |  2 +-
 test/bash-completion-test.el | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bash-completion.el b/bash-completion.el
index 7de8bb226a..608341b17a 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -759,7 +759,7 @@ result. See `bash-completion-fix' for more details."
         (push (bash-completion-fix
                completion parsed-stub unparsed-stub open-quote completion-type 
nil)
               result))
-      (nreverse result))))
+      (delete-dups (nreverse result)))))
 
 (defun bash-completion-fix
     (str parsed-prefix unparsed-prefix open-quote completion-type single)
diff --git a/test/bash-completion-test.el b/test/bash-completion-test.el
index 5532da53e0..5c112affa7 100644
--- a/test/bash-completion-test.el
+++ b/test/bash-completion-test.el
@@ -582,7 +582,15 @@ Return (const return-value new-buffer-content)"
        "hello world\nhello \n\n"
        (cl-letf (((symbol-function 'bash-completion-buffer)
                   (lambda () (current-buffer))))
-         (bash-completion-extract-candidates "hello" "hello" nil nil)))))))
+         (bash-completion-extract-candidates "hello" "hello" nil nil)))))
+    (should
+     (equal
+      '("hello" "hellish" "hellow")
+      (bash-completion-test-with-buffer
+       "hello\nhellish\nhello\nhellow\n"
+       (cl-letf (((symbol-function 'bash-completion-buffer)
+                  (lambda () (current-buffer))))
+         (bash-completion-extract-candidates "hell" "hell" nil nil)))))))
 
 (ert-deftest bash-completion-nonsep-test ()
   (should (equal "^ \t\n\r;&|'\"#"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]