diff options
author | Kevin Ballard <kevin@sb.org> | 2016-01-10 17:13:08 -0800 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2016-01-10 17:25:22 -0800 |
commit | 1dac0041d55992be1340f9b28ae425c100ff4ba7 (patch) | |
tree | 2681231dedbddf3328ed1f14eba225efe38d19cd /tests | |
parent | 43728fe7a0de1aefe94502d9910ce885f8ba6ee9 (diff) |
Stop unescaping strings with `commandline -b`
The fix for #2075 inadvertently started unescaping the strings emitted
from `commandline -b`. Only strings emitted with the `-o` flag are
supposed to be unescaped.
Fixes #2210.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/commandline.expect | 30 | ||||
-rw-r--r-- | tests/commandline.expect.err | 0 | ||||
-rw-r--r-- | tests/commandline.expect.out | 8 | ||||
-rw-r--r-- | tests/commandline.expect.status | 1 |
4 files changed, 39 insertions, 0 deletions
diff --git a/tests/commandline.expect b/tests/commandline.expect new file mode 100644 index 00000000..8db0c833 --- /dev/null +++ b/tests/commandline.expect @@ -0,0 +1,30 @@ +# vim: set filetype=expect: + +spawn $fish + +expect_prompt + +send_line "bind '~' 'handle_tilde'" +expect_prompt + +# printing the current buffer should not remove quoting +send_line "function handle_tilde; echo; echo '@GUARD:1@'; commandline -b; echo '@/GUARD:1@'; commandline -b ''; end" +expect_prompt +send_line {echo \en one "two three" four'five six'{7} 'eight~} +expect_prompt -re {\r\n@GUARD:1@\r\n(.*)\r\n@/GUARD:1@\r\n} { + puts "a:" + puts $expect_out(1,string) +} unmatched { + abort "Couldn't find guard 1" +} + +# printing the buffer with -o should remove quoting +send_line "function handle_tilde; echo; echo '@GUARD:2@'; commandline -bo; echo '@/GUARD:2@'; commandline -b ''; end" +expect_prompt +send_line {echo one "two three" four'five six'{7} 'eight~} +expect_prompt -re {\r\n@GUARD:2@\r\n(.*)\r\n@/GUARD:2@\r\n} { + puts "b:" + puts [string map {\r {}} $expect_out(1,string)] +} unmatched { + abort "Couldn't find guard 2" +} diff --git a/tests/commandline.expect.err b/tests/commandline.expect.err new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/commandline.expect.err diff --git a/tests/commandline.expect.out b/tests/commandline.expect.out new file mode 100644 index 00000000..ea3879a8 --- /dev/null +++ b/tests/commandline.expect.out @@ -0,0 +1,8 @@ +a: +echo \en one "two three" four'five six'{7} 'eight +b: +echo +one +two three +fourfive six{7} +eight diff --git a/tests/commandline.expect.status b/tests/commandline.expect.status new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/commandline.expect.status @@ -0,0 +1 @@ +0 |