aboutsummaryrefslogtreecommitdiffstats
path: root/testcases-quote
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-06-26 22:27:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-06-26 22:27:58 -0700
commit0907050e35c9887dcf961bda2111bd34c3eeb0e8 (patch)
tree5c7a6494195460be9eed1360fb4cbfc236434dbd /testcases-quote
parentc9f4b29927db3499e6b2d0b7ac0399447bca073a (diff)
downloadcppawk-0907050e35c9887dcf961bda2111bd34c3eeb0e8.tar.gz
cppawk-0907050e35c9887dcf961bda2111bd34c3eeb0e8.tar.bz2
cppawk-0907050e35c9887dcf961bda2111bd34c3eeb0e8.zip
Add function for shell quoting.
* README.md: Mention <quote.h> and cppawk-quote man page. * share/cppawk/include/quote.h, * share/cppawk/include/quote-priv.h: New files. * testcases-quote: New file. * cppawk-quote.1: New file. * runtests: Add testcases-quote.
Diffstat (limited to 'testcases-quote')
-rw-r--r--testcases-quote36
1 files changed, 36 insertions, 0 deletions
diff --git a/testcases-quote b/testcases-quote
new file mode 100644
index 0000000..272261b
--- /dev/null
+++ b/testcases-quote
@@ -0,0 +1,36 @@
+1:
+$cppawk '
+#include <quote.h>
+
+BEGIN {
+ print q("")
+ print q("abc")
+ print q("abc\\def")
+ print q("'\''foo'\''")
+ print q("\"foo\"")
+ print q("\"fo'\''o\"")
+ print q("abc\ndef")
+ print q("abc*def")
+ print q("abc?def")
+ print q("abc`def")
+ print q("abc`de'\''f")
+ print q("a b c")
+ print q("a\tb\tc")
+ print q("~bob/foo")
+}'
+:
+
+abc
+'abc\def'
+"'foo'"
+'"foo"'
+"\"fo'o\""
+"abc
+def"
+'abc*def'
+'abc?def'
+'abc`def'
+'abc`de'\''f'
+"a b c"
+"a b c"
+'~bob/foo'