summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-09-30 01:08:51 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2018-09-30 01:08:51 +0100
commit8fdf20fd84ec88d8f8a250f56d2b4d29ba946392 (patch)
tree4dd39d4b84fff56315dd06fa230c8787d9a0dda3 /test
parentc092711614b9b12df56869a95bc9609f913e7be3 (diff)
Expansions: extract methods for JSON objects and arrays. Bug 2282
Diffstat (limited to 'test')
-rw-r--r--test/scripts/0000-Basic/000221
-rw-r--r--test/stdout/00029
2 files changed, 30 insertions, 0 deletions
diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002
index 27bf70806..65ce40b6a 100644
--- a/test/scripts/0000-Basic/0002
+++ b/test/scripts/0000-Basic/0002
@@ -874,6 +874,27 @@ ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
${env {USER}}
${env {NO_SUCH_VARIABLE} {oops, success} {correct}}
+# JSON
+
+${extract json {Url} \
+ { \{ \"Url\": \"http://www.example.com/image/481989943\",\
+ \"Height\": 125,\
+ \"Width\": 100\
+ \} \
+ } \
+ }
+${extract json {Width} \
+ { \{ \"Url\": \"http://www.example.com/image/481989943\",\
+ \"Height\": 125,\
+ \"Width\": 100\
+ \} \
+ } \
+ }
+${extract json {2} {[116, 943, 234, 38793]} }
+${extract json {2} {${extract json{IDs} {\{"other":"foo", "IDs": [116, 943, 234]\} }}} }
+
+${extract json {seconds} { \{"hours":0, "mins":0, "seconds":59\} }}
+${extract json {seconds} {${extract json {2} { ["irrelevant", \{"hours":0, "mins":0, "seconds":59\}] }}}}
****
# Test "escape" with print_topbitchars
exim -be -DPTBC=print_topbitchars
diff --git a/test/stdout/0002 b/test/stdout/0002
index 20f418360..a8d1361d1 100644
--- a/test/stdout/0002
+++ b/test/stdout/0002
@@ -829,6 +829,15 @@ xyz
> CALLER
> correct
>
+> # JSON
+>
+> "http://www.example.com/image/481989943"
+> 100
+> 943
+> 943
+>
+> 59
+> 59
>
> escape: B7·F2ò
>