summaryrefslogtreecommitdiffstats
path: root/tests/015
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-09-01 19:26:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-09-01 19:26:35 -0700
commit9c0e5743188588ece98197880a3f1174170dc563 (patch)
tree6e94c391062b28a5277025bdeac9127fdc483483 /tests/015
parent43f64bd2d69cf39d09c4a3b96cd28d0966a6eda6 (diff)
downloadtxr-9c0e5743188588ece98197880a3f1174170dc563.tar.gz
txr-9c0e5743188588ece98197880a3f1174170dc563.tar.bz2
txr-9c0e5743188588ece98197880a3f1174170dc563.zip
New function: str-esc.
* lib.[ch] (str_esc): New function. * eval.c (eval_init): str-esc intrinsic registered. * tests/015/esc.tl: New file. * txr.1: Documented.
Diffstat (limited to 'tests/015')
-rw-r--r--tests/015/esc.tl39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/015/esc.tl b/tests/015/esc.tl
new file mode 100644
index 00000000..cf3619c8
--- /dev/null
+++ b/tests/015/esc.tl
@@ -0,0 +1,39 @@
+(load "../common")
+
+(mtest
+ (str-esc "$*." "~" "") ""
+ (str-esc "$*." "~" "a") "a"
+ (str-esc "$*." "~" "~") "~"
+ (str-esc "$*." "~" "*") "~*"
+ (str-esc "$*." "~" ".") "~.")
+
+(mtest
+ (str-esc "$*." "~" "aa") "aa"
+ (str-esc "$*." "~" "a~") "a~"
+ (str-esc "$*." "~" "a$") "a~$"
+ (str-esc "$*." "~" "a*") "a~*"
+ (str-esc "$*." "~" "a.") "a~.")
+
+(mtest
+ (str-esc "$*." "~" "~a") "~a"
+ (str-esc "$*." "~" "$a") "~$a"
+ (str-esc "$*." "~" "*a") "~*a"
+ (str-esc "$*." "~" ".a") "~.a")
+
+(mtest
+ (str-esc "$*." "~" "a~b") "a~b"
+ (str-esc "$*." "~" "a$b") "a~$b"
+ (str-esc "$*." "~" "a*b") "a~*b"
+ (str-esc "$*." "~" "a.b") "a~.b")
+
+(mtest
+ (str-esc "$*." "~" "~a~") "~a~"
+ (str-esc "$*." "~" "$a$") "~$a~$"
+ (str-esc "$*." "~" "*a*") "~*a~*"
+ (str-esc "$*." "~" ".a.") "~.a~.")
+
+(test
+ (str-esc "$*." "~" "$*.a$*.b") "~$~*~.a~$~*~.b")
+
+(test
+ (str-esc "<>" "<" "(<<>>)") "(<<<<<><>)")