]> git.eshelyaron.com Git - emacs.git/commitdiff
* test/lisp/minibuffer-tests.el (completion-table-test-quoting): New test
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 26 Nov 2019 18:18:18 +0000 (13:18 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 26 Nov 2019 18:18:18 +0000 (13:18 -0500)
* test/data/minibuffer-test-cttq$tion: New file-name test data.

test/data/minibuffer-test-cttq$tion [new file with mode: 0644]
test/lisp/minibuffer-tests.el

diff --git a/test/data/minibuffer-test-cttq$tion b/test/data/minibuffer-test-cttq$tion
new file mode 100644 (file)
index 0000000..e69de29
index 35df7cc17f18267269c82ca401db4b6a1e3bbd3a..6b297244214cac966001a99f844abe2f400d3ad8 100644 (file)
     (should (equal (try-completion "B-hel" subvtable)
                    "B-hello"))))
 
+(ert-deftest completion-table-test-quoting ()
+  (let ((process-environment
+         `("CTTQ1=ed" "CTTQ2=et/" ,@process-environment)))
+    (pcase-dolist (`(,input ,output)
+                   '(
+                     ;; Test that $ in files is properly $$ quoted.
+                     ("data/m-cttq" "data/minibuffer-test-cttq$$tion")
+                     ;; Test that $$ in input is properly unquoted.
+                     ("data/m-cttq$$t" "data/minibuffer-test-cttq$$tion")
+                     ;; Test that env-vars are preserved.
+                     ("lisp/c${CTTQ1}et/se-u" "lisp/c${CTTQ1}et/semantic-utest")
+                     ("lisp/ced${CTTQ2}se-u" "lisp/ced${CTTQ2}semantic-utest")
+                     ;; Test that env-vars don't prevent partial-completion.
+                     ;; FIXME: Ideally we'd like to keep the ${CTTQ}!
+                     ("lis/c${CTTQ1}/se-u" "lisp/cedet/semantic-utest")
+                     ))
+      (should (equal (completion-try-completion input
+                                                #'completion--file-name-table
+                                                nil (length input))
+                     (cons output (length output)))))))
+
 (provide 'completion-tests)
 ;;; completion-tests.el ends here