Skip to content

Commit f85519c

Browse files
akinomyogascop
authored andcommitted
test(quote_readline): add a failing test for unprocessed escape sequences
1 parent 58e810b commit f85519c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/t/unit/test_unit_quote_readline.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from conftest import assert_bash_exec
5+
from conftest import assert_bash_exec, assert_complete
66

77

88
@pytest.mark.bashcomp(cmd=None, temp_cwd=True)
@@ -75,6 +75,23 @@ def test_github_issue_492_3(self, bash):
7575
os.mkdir("./ret=$(echo injected >&2)")
7676
assert_bash_exec(bash, "quote_readline $'\\'$*' >/dev/null")
7777

78+
def test_github_issue_526_1(self, bash):
79+
"""Regression tests for unprocessed escape sequences after quotes
80+
81+
Ref [1] https://github.com/scop/bash-completion/pull/492#discussion_r637213822
82+
Ref [2] https://github.com/scop/bash-completion/pull/526
83+
84+
The escape sequences in the local variable of "value" in
85+
"_quote_readline_by_ref" needs to be unescaped by passing it to printf
86+
as the format string. This causes a problem in the following case
87+
[where the spaces after "alpha\" is a TAB character inserted in the
88+
command string by "C-v TAB"]:
89+
90+
$ echo alpha\ b[TAB]
91+
92+
"""
93+
os.mkdir("./alpha\tbeta")
94+
assert assert_complete(bash, "echo alpha\\\026\tb", rendered_cmd="echo alpha\\ b") == "eta/"
7895

7996
@pytest.mark.bashcomp(cmd=None, temp_cwd=True, pre_cmds=("shopt -s failglob",))
8097
class TestUnitQuoteReadlineWithFailglob:

0 commit comments

Comments
 (0)