branch: elpa/bash-completion
commit 6a0ada627810c3ebacc362ff690653a1d34eb2db
Author: Stephane Zermatten <[email protected]>
Commit: Stephane Zermatten <[email protected]>
completed test cases
---
bash-completion.el | 1 -
bash-completion_test.el | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/bash-completion.el b/bash-completion.el
index d32a74c1a4..379057e45a 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -95,7 +95,6 @@ Call bash to do the completion."
"'")))
(defun bash-completion-escape (word)
- (message "escape: %s" word)
(if (string-match "^['\"]" word)
word
(replace-regexp-in-string "\\([ '\"]\\)" "\\\\\\1" word)))
diff --git a/bash-completion_test.el b/bash-completion_test.el
index 93acddee21..09cb8bada8 100644
--- a/bash-completion_test.el
+++ b/bash-completion_test.el
@@ -400,6 +400,49 @@ garbage
(bash-completion-fix " world" "hello")
"hello\\ world")
+ ("bash-completion-extract"
+ (flet ((bash-completion-buffer () (current-buffer)))
+ (sz-testutils-with-buffer
+ "hello world\nhello \n\n"
+ (bash-completion-extract "hello")))
+ '("hello\\ world" "hello "))
+
+ ("bash-completion-nonsep"
+ (list
+ (bash-completion-nonsep nil)
+ (bash-completion-nonsep ?')
+ (bash-completion-nonsep ?\"))
+ '("^ \t\n\r'\"" "^ \t\n\r'" "^ \t\n\r\""))
+
+
+ ("bash-completion-escape"
+ (bash-completion-escape "He said: \"hello, 'you'\"")
+ "He\\ said:\\ \\\"hello,\\ \\'you\\'\\\"")
+
+ ("bash-completion-escape not if double quoted"
+ (bash-completion-escape "\"hello, you")
+ "\"hello, you")
+
+ ("bash-completion-escape not if single quoted"
+ (bash-completion-escape "'hello, you")
+ "'hello, you")
+
+ ("bash-completion-quote allowed"
+ (bash-completion-quote "abc_ABC/1-2.3")
+ "abc_ABC/1-2.3")
+
+ ("bash-completion-quote quoted"
+ (bash-completion-quote "a$b")
+ "'a$b'")
+
+ ("bash-completion-quote quoted single quote"
+ (bash-completion-quote "a'b")
+ "'a'\\''b'")
+
+ ("bash-completion-join"
+ (bash-completion-join '("ls" "-l" "/a/b" "/a/b c" "/a/b'c" "$help/d"))
+ "ls -l /a/b '/a/b c' '/a/b'\\''c' '$help/d'")
+
))
;; ---------- integration tests