summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2023-07-18 05:54:44 +0200
committerNico Williams <nico@cryptonector.com>2023-07-18 12:12:50 -0500
commit15fd31de78c7dbc1af0a7cf735587dc5b1729d20 (patch)
tree1890f706dc45928dc5ebc3e02a47e55e80028428 /tests
parent01dfd8b86d1248e80d868523c63c87356bca9c6f (diff)
Define examples in the "examples" field instead of "example"
Only examples defined in the "examples" field are generated, if they are defined in "example", they are just ignored. Also fix a bunch of incorrect tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/man.test4
-rw-r--r--tests/manonig.test32
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/man.test b/tests/man.test
index 25aeb9dd..02f95329 100644
--- a/tests/man.test
+++ b/tests/man.test
@@ -572,6 +572,10 @@ join(" ")
["a",1,2.3,true,null,false]
"a 1 2.3 true false"
+ascii_upcase
+"useful but not for é"
+"USEFUL BUT NOT FOR é"
+
[while(.<100; .*2)]
1
[1,2,4,8,16,32,64]
diff --git a/tests/manonig.test b/tests/manonig.test
index 36f3b091..11c33fb3 100644
--- a/tests/manonig.test
+++ b/tests/manonig.test
@@ -42,3 +42,35 @@ capture("(?<a>[a-z]+)-(?<n>[0-9]+)")
"xyzzy-14"
{ "a": "xyzzy", "n": "14" }
+scan("c")
+"abcdefabc"
+"c"
+"c"
+
+split(", *"; null)
+"ab,cd, ef"
+["ab","cd","ef"]
+
+splits(", *")
+"ab,cd, ef, gh"
+"ab"
+"cd"
+"ef"
+"gh"
+
+sub("[^a-z]*(?<x>[a-z]+)"; "Z\(.x)"; "g")
+"123abc456def"
+"ZabcZdef"
+
+[sub("(?<a>.)"; "\(.a|ascii_upcase)", "\(.a|ascii_downcase)")]
+"aB"
+["AB","aB"]
+
+gsub("(?<x>.)[^a]*"; "+\(.x)-")
+"Abcabc"
+"+A-+a-"
+
+[gsub("p"; "a", "b")]
+"p"
+["a","b"]
+