diff options
| author | Jim Porter | 2022-03-01 18:53:42 -0800 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-03-03 14:59:33 +0100 |
| commit | d72cd4a2b761d325e5bb3e664781a4c9001eb2c2 (patch) | |
| tree | 7d59b1ede2b3c9620d4b07b7df8c557497d3dc29 /test | |
| parent | 990f36fa108092c8b93692bb80c6fbd0b6b8f391 (diff) | |
| download | emacs-d72cd4a2b761d325e5bb3e664781a4c9001eb2c2.tar.gz emacs-d72cd4a2b761d325e5bb3e664781a4c9001eb2c2.zip | |
Allow splitting strings in Eshell expansions with "plain" strings
Since '$var[hello 0]' doesn't make sense when 'var' is a string, the
previous restriction was unnecessary.
* lisp/eshell/esh-var.el (Commentary): Update documentation.
(eshell-apply-indices): Allow "plain" strings to split strings.
* test/lisp/eshell/esh-var-test.el
(esh-var-test/interp-var-string-split-indices)
(esh-var-test/quoted-interp-var-string-split-indices): Update tests.
* doc/misc/eshell.texi (Dollars expansion): Update documentation.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/eshell/esh-var-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-var-tests.el b/test/lisp/eshell/esh-var-tests.el index e679174939b..d09dd614de8 100644 --- a/test/lisp/eshell/esh-var-tests.el +++ b/test/lisp/eshell/esh-var-tests.el | |||
| @@ -84,6 +84,11 @@ | |||
| 84 | (should (equal (eshell-test-command-result "echo $eshell-test-value[: 0]") | 84 | (should (equal (eshell-test-command-result "echo $eshell-test-value[: 0]") |
| 85 | "zero")) | 85 | "zero")) |
| 86 | (should (equal (eshell-test-command-result "echo $eshell-test-value[: 0 2]") | 86 | (should (equal (eshell-test-command-result "echo $eshell-test-value[: 0 2]") |
| 87 | '("zero" "two")))) | ||
| 88 | (let ((eshell-test-value "zeroXoneXtwoXthreeXfour")) | ||
| 89 | (should (equal (eshell-test-command-result "echo $eshell-test-value[X 0]") | ||
| 90 | "zero")) | ||
| 91 | (should (equal (eshell-test-command-result "echo $eshell-test-value[X 0 2]") | ||
| 87 | '("zero" "two"))))) | 92 | '("zero" "two"))))) |
| 88 | 93 | ||
| 89 | (ert-deftest esh-var-test/interp-var-regexp-split-indices () | 94 | (ert-deftest esh-var-test/interp-var-regexp-split-indices () |
| @@ -216,6 +221,13 @@ inside double-quotes" | |||
| 216 | "zero")) | 221 | "zero")) |
| 217 | (should (equal (eshell-test-command-result | 222 | (should (equal (eshell-test-command-result |
| 218 | "echo \"$eshell-test-value[: 0 2]\"") | 223 | "echo \"$eshell-test-value[: 0 2]\"") |
| 224 | '("zero" "two")))) | ||
| 225 | (let ((eshell-test-value "zeroXoneXtwoXthreeXfour")) | ||
| 226 | (should (equal (eshell-test-command-result | ||
| 227 | "echo \"$eshell-test-value[X 0]\"") | ||
| 228 | "zero")) | ||
| 229 | (should (equal (eshell-test-command-result | ||
| 230 | "echo \"$eshell-test-value[X 0 2]\"") | ||
| 219 | '("zero" "two"))))) | 231 | '("zero" "two"))))) |
| 220 | 232 | ||
| 221 | (ert-deftest esh-var-test/quoted-interp-var-regexp-split-indices () | 233 | (ert-deftest esh-var-test/quoted-interp-var-regexp-split-indices () |