summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-09-01 20:36:52 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-09-01 20:36:52 -0700
commita5d5536fcf2fe616b8c0941df0bc92f3bd9761ba (patch)
tree59d522eb4ec987ed034707d2644827cb4bc051e8 /tests
parent9c0e5743188588ece98197880a3f1174170dc563 (diff)
downloadtxr-a5d5536fcf2fe616b8c0941df0bc92f3bd9761ba.tar.gz
txr-a5d5536fcf2fe616b8c0941df0bc92f3bd9761ba.tar.bz2
txr-a5d5536fcf2fe616b8c0941df0bc92f3bd9761ba.zip
New functions for shell escaping.
* stream.c (sh_esc, sh_esc_all, sh_esc_dq, sh_esc_sq): New static functions. (stream_init): sh-esc, sh-esc-all, sh-esc-dq, sh-esc-sq: Intrinsics registered. * tests/018/sh-esc.tl: New file. * txr.1: Documented.
Diffstat (limited to 'tests')
-rw-r--r--tests/018/sh-esc.tl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/018/sh-esc.tl b/tests/018/sh-esc.tl
new file mode 100644
index 00000000..3466ee76
--- /dev/null
+++ b/tests/018/sh-esc.tl
@@ -0,0 +1,11 @@
+(load "../common")
+
+(mtest
+ (sh-esc "|&;<>()$`\\\"' \t\n*?[#~=%abc")
+ "\\|\\&\\;\\<\\>\\(\\)\\$\\`\\\\\\\"\\'\\ \\\t\\\n\\*\\?\\[\\#\\~=%abc"
+ (sh-esc-all "|&;<>()$`\\\"' \t\n*?[#~=%abc")
+ "\\|\\&\\;\\<\\>\\(\\)\\$\\`\\\\\\\"\\'\\ \\\t\\\n\\*\\?\\[\\#\\~\\=\\%abc"
+ (sh-esc-dq "$`\\\"\n'abc()*~")
+ "\\$\\`\\\\\\\"\\\n'abc()*~"
+ (sh-esc-sq "$`\\\"\n'abc()*~")
+ "$`\\\"\n'\\''abc()*~")