mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 11:50:51 -08:00
Fix command-line parsing regression in erc-cmd-DCC
* lisp/erc/erc-compat.el (erc-compat--28-split-string-shell-command, erc-compat--split-string-shell-command): Remove unused function and macro. * lisp/erc/erc-dcc.el (erc-cmd-DCC): Use own arg-parsing function. * lisp/erc/erc.el (erc--shell-parse-regexp, erc--split-string-shell-cmd): New regexp constant and arg-parsing function based on those in shell.el. * test/lisp/erc/erc-dcc-tests.el (erc-dcc-tests--erc-dcc-do-GET-command): Accept new `nuh' argument representing message source/sender. (erc-dcc-do-GET-command): Add tests for regression involving pipe character. * test/lisp/erc/erc-tests.el (erc--split-string-shell-cmd): New test. (Bug#62444) Thanks to Fernando de Morais for reporting this bug.
This commit is contained in:
parent
4e8d579f3d
commit
b95bb644ec
5 changed files with 99 additions and 29 deletions
|
|
@ -1218,6 +1218,52 @@
|
|||
|
||||
(should-not calls))))))
|
||||
|
||||
(ert-deftest erc--split-string-shell-cmd ()
|
||||
|
||||
;; Leading and trailing space
|
||||
(should (equal (erc--split-string-shell-cmd "1 2 3") '("1" "2" "3")))
|
||||
(should (equal (erc--split-string-shell-cmd " 1 2 3 ") '("1" "2" "3")))
|
||||
|
||||
;; Empty string
|
||||
(should (equal (erc--split-string-shell-cmd "\"\"") '("")))
|
||||
(should (equal (erc--split-string-shell-cmd " \"\" ") '("")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 \"\"") '("1" "")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 \"\" ") '("1" "")))
|
||||
(should (equal (erc--split-string-shell-cmd "\"\" 1") '("" "1")))
|
||||
(should (equal (erc--split-string-shell-cmd " \"\" 1") '("" "1")))
|
||||
|
||||
(should (equal (erc--split-string-shell-cmd "''") '("")))
|
||||
(should (equal (erc--split-string-shell-cmd " '' ") '("")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 ''") '("1" "")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 '' ") '("1" "")))
|
||||
(should (equal (erc--split-string-shell-cmd "'' 1") '("" "1")))
|
||||
(should (equal (erc--split-string-shell-cmd " '' 1") '("" "1")))
|
||||
|
||||
;; Backslash
|
||||
(should (equal (erc--split-string-shell-cmd "\\ ") '(" ")))
|
||||
(should (equal (erc--split-string-shell-cmd " \\ ") '(" ")))
|
||||
(should (equal (erc--split-string-shell-cmd "1\\ ") '("1 ")))
|
||||
(should (equal (erc--split-string-shell-cmd "1\\ 2") '("1 2")))
|
||||
|
||||
;; Embedded
|
||||
(should (equal (erc--split-string-shell-cmd "\"\\\"\"") '("\"")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 \"2 \\\" \\\" 3\"")
|
||||
'("1" "2 \" \" 3")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 \"2 ' ' 3\"")
|
||||
'("1" "2 ' ' 3")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 '2 \" \" 3'")
|
||||
'("1" "2 \" \" 3")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 '2 \\ 3'")
|
||||
'("1" "2 \\ 3")))
|
||||
(should (equal (erc--split-string-shell-cmd "1 \"2 \\\\ 3\"")
|
||||
'("1" "2 \\ 3"))) ; see comment re ^
|
||||
|
||||
;; Realistic
|
||||
(should (equal (erc--split-string-shell-cmd "GET bob \"my file.txt\"")
|
||||
'("GET" "bob" "my file.txt")))
|
||||
(should (equal (erc--split-string-shell-cmd "GET EXAMPLE|bob \"my file.txt\"")
|
||||
'("GET" "EXAMPLE|bob" "my file.txt")))) ; regression
|
||||
|
||||
|
||||
;; The behavior of `erc-pre-send-functions' differs between versions
|
||||
;; in how hook members see and influence a trailing newline that's
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue