Testsuite: enhance json extract tests
[exim.git] / test / stdout / 0002
index 5cdba5219bcdb3399cf156f4397b61e8bc862907..729435472d6cc48a9b4713266e5893d0b8fdc997 100644 (file)
@@ -6,11 +6,15 @@
 > # Some fixed variables
 > 
 > exim_path: TESTSUITE/eximdir/exim
+> exim_version: x.yz
+> config_dir: TESTSUITE
+> config_file: TESTSUITE/test-config
 > primary_hostname: myhost.test.ex
 > primary_hostname: myhost.test.ex
 > qualify_domain: myhost.test.ex
 > bounce_return_size_limit: 102400
 > spool_directory: TESTSUITE/spool
+> queue_name: 
 > Failed: unknown variable in "${unknown}"
 > h_subject: (should be empty)
 > h_subject: (should be empty)
 > +
 > +
 > 
+> # List operations
+> 
+> filter: "a:b:c"
+> filter: a:c
+> filter: a'c
+> filter: ''a' ''c
+> filter: ""
+> 
+> map: ""
+> map: a:b:c
+> map: ::a::: ::b::: ::c::
+> map: fail string
+> map: []:[b]:[c]
+> 
+> reduce: "+"
+> reduce: +abc
+> reduce: 6
+> reduce: 9
+> # Check for extract corrupting reduce's 
+> reduce: a , b
+> 
+> listnamed: *.aa.bb : ^\Nxxx(.*)
+> listnamed: *.aa.bb : ^\Nxxx(.*)
+> listnamed: V4NET.11.12.13 : iplsearch;TESTSUITE/aux-fixed/0002.iplsearch
+> listnamed: *.aa.bb : ^\Nxxx(.*) : ;;
+> listnamed: a : b;c : *.aa.bb : ^\Nxxx(.*) : ;; : 2001::630::212::8::204::::b664
+> Failed: "nolist" is not a named list
+> listnamed: *.aa.bb : ^\Nxxx(.*)
+> Failed: "hlist" is not a domain named list
+> Failed: bad suffix on "list" operator
+> 
+> listcount: 3
+> listcount: 0
+> listcount: 3
+> listcount: 2
+> 
+> listextract: b
+> listextract: XcX
+> listextract: 
+> listextract: 
+> listextract: fail
+> Failed: "listextract" failed and "fail" requested
+> 
+> sort: 1:2:3:4
+> sort: 4,3,2,1
+> sort: a:aa:B:c
+> sort: 10 smtp.ex.com:100 r2.ex.com:666 r99.ex.com
+> sort: 10,smtp.ex.com:100,r2.ex.com:666,r99.ex.com
+> sort: ""
+> 
+> # Tests with iscntrl() and illegal separators
+> 
+> map: 'a'
+''
+'b'
+'c'
+> 
+> Failed: error in expression evaluation: expecting number or opening parenthesis (after processing "0+") inside "reduce" item
+> reduce: 6
+> reduce: 6
+> reduce: 6
+> 
 > # Operators
 > 
+> Failed: Not enough arguments for 'acl' (min is 1)
+> Failed: Not enough arguments for 'acl' (min is 1)
+> Failed: error from acl "a_nosuch"
+> acl: (0) [] []
+> acl: (1) [person@dom.ain] []
+> acl: (2) [firstarg] [secondarg]
+> acl: (1) [arg with spaces] []
+> acl: 
+> acl: 
+> acl: (0) [] []
+> acl: (1) [person@dom.ain] []
+> Failed: error from acl "a_defer"
+> acl: (2) [new arg1] [top_arg_1]
+> acl:  (1) [1] [] (1) [2] [] (1) [3] [] (1) [4] []
+> 
 > addrss: local-part@dom.ain
 > addrss: local-part@dom.ain
 > domain: dom.ain
 > domain: dom.ain
-> escape: B7\267F2\362
+> 
+> addresses: ''abc@xyz' ''pqr@xyz
+> addresses: local-part@dom.ain
+> addresses: local-part@dom.ain+xyz@abc
+> addresses: local-part@dom.ain:xyz@abc:p@q:r@s
+> addresses: 
+> Failed: output separator missing in expanding ${addresses:>}
+> 
+> escape:     B7\267F2\362
+> excape8bit: undisturbed text tab
+newline        tab\134backslash ~tilde\177DEL\200\201.
+> 
 > eval:   2
 > eval:   7
 > eval:   9
 > eval:   1
 > eval:   1
 > Failed: error in expression evaluation: expecting closing parenthesis (after processing "-2 - (-3")
-> Failed: error in expression evaluation: expecting + or - (after processing "-2 - -3")
+> Failed: error in expression evaluation: expecting operator (after processing "-2 - -3")
 > eval:   1
 > eval:   -5
-> Failed: error in expression evaluation: expecting number or opening parenthesis (after processing "-2 -")
+> eval:   1
 > eval:   40962
 > eval:   63
-> Failed: error in expression evaluation: expecting + or - (after processing "0")
+> Failed: error in expression evaluation: expecting operator (after processing "0")
 > eval10: 77
 > eval10: 8
+> Failed: error in expression evaluation: expecting operator (after processing "0")
+> eval:   4
+> eval:   4
+> eval:   4
+> eval:   13
+> eval:   9
+> eval:   6
+> eval:   3
+> eval:   0
+> eval:   24
+> eval:   4608
+> eval:   4608
+> eval:   -4608
+> 
 > expand: $primary_hostname myhost.test.ex
 > hash:   jmg monty fbWx
 > hash:   abcX abX aX X
 > hex2b64:MPPJPkZDbetYunCBao7BJA==
 > hex2b64:ztcfpyNSMb7Tg/rP3EHE3cwi7PE=
 > 
-> The base62 operator is actually a base36 operator in the Darwin and Cygwin
+> base32: 0  <>
+> base32: 1  <b>
+> base32: 31 <7>
+> base32: 32 <ba>
+> base32: 42 <bk>
+> Failed: argument for base32 operator is "0x1", which is not a decimal number
+> 
+> base32d: 0  0
+> base32d: 1  1
+> base32d: 31 31
+> base32d: 32 32
+> base32d: 42 42
+> Failed: argument for base32d operator is "ABC", which is not a base 32 number
+> 
+> the base62 operator is actually a base36 operator in the Darwin and Cygwin
 > environments. Write cunning tests that produce the same output in both cases,
 > while doing a reasonable check.
 > 
 > mask:   0.0.0.0/0
 > Failed: missing mask value in "192.168.10.206"
 > Failed: "a.b.c.d" is not an IP address
+> ipv6denorm: 0000:0000:0000:0000:0000:0000:0000:0001
+> ipv6denorm: fe00:0000:0000:0000:0000:0000:0000:0001
+> ipv6denorm: 0000:0000:0000:0000:0000:ffff:c0a8:0001
+> ipv6denorm: fe80:0000:0000:0000:0000:0000:c0a8:0001
+> ipv6norm:   ::1
+> ipv6norm:   2a00::
+> ipv6norm:   2a00::1
+> ipv6norm:   2a00:eadf::1:0
+> ipv6norm:   2a00:eadf:0:1::
+> ipv6norm:   2a00::
+> ipv6norm:   2a00:2:3:4:5:6:7:8
 > nhash:  19 0/61
 > lc/uc:  the quick  BROWN FOX
 > length: The quick  abc
 > quote_local_part: "abcd\"ef"
 > quote_local_part: ""
 > rxquote:aZ09\_\,\-Q ab\*cd abcd\"ef
+> hexquote: \x01\x02\x03\x04\x05\x06\x07\x20\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x20\x10\x11\x12\x13\x14\x15\x16\x17\x20\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x20!"#$%&'\x20()*+,-./\x2001234567\x2089:;<=>?\x20@ABCDEFG\x20HIJKLMNO\x20PQRSTUVW\x20XYZ[\]^_\x20`abcdefg\x20hijklmno\x20pqrstuvw\x20xyz{|}~\x7f
 > substr: ba 34  1
 > substr: barb rhuba
 > substr: 
 > substr: 
 > str2b64:YWJjZA==
 > str2b64:VGhlIHF1aWNrIGJyb3duIAogZm94
+> base64: YWJjZA==
+> base64: VGhlIHF1aWNrIGJyb3duIAogZm94
+> base64d:abcd
+> base64d:The quick brown 
+ fox
 > strlen: 0
 > strlen: 1
 > strlen: 8
+> time_eval:     10
+> time_eval:     7200
+> time_eval:     86700
+> time_eval:     788645
+> Failed: string "14" is not an Exim time interval in "time_eval" operator
+> Failed: string "rhubarb" is not an Exim time interval in "time_eval" operator
 > time_interval: 0s
 > time_interval: 44s
 > time_interval: 1w4d13h46m39s
 > 
 > # Error forms
 > 
-> Failed: missing or misplaced { or }
+> Failed: Not enough arguments for 'hash' (min is 2)
 > Failed: "nonnumber" is not a number (in "hash" expansion)
-> Failed: Too many arguments for "hash" (max is 3)
+> Failed: Too many arguments for 'hash' (max is 3)
 > Failed: "-2" is not a positive number (in "substr" expansion)
 > 
 > # Skipped operators
 > md5:    NO
 > mask:   NO
 > 
+> # Number suffixes in conditions
+> 1k: y
+> 1K: y
+> 1M: y
+> 1G: y
+> 
+> # Numeric overflow
+> # >32b should work, >64b not
+> 
+> 1 > 2047M                n
+> 1 > 2048M                n
+> 1 > 4096000000           n
+> 1 > 4096M                n
+> 1 > 4611686018427387904  n
+> Failed: absolute value of integer "46116860184273879040" is too large (overflow)
+> 
 > # Conditions
 > 
 > 2=2:    y
 > 2>3:    n
 > 3>3:    n
 > 4>3:    y
+> 1>-1:   y
 > 2>=3:   n
 > 3>=3:   y
 > 4>=3:   y
 > 3<=3:   y
 > 4<=3:   n
 > 5<=3:   n
+> -3<=1:  y
 > 
 > 5>3k:   n
 > 5>3m:   n
-> Failed: "3z " is not a number
-> Failed: "a" is not a number
+> Failed: invalid integer "3z "
+> Failed: integer expected but "a" found
+> Failed: integer expected but "${substr_2_2:65535}" found
+> 
+> >0:     n
+> =:      y
+> -2<:    y
+> 08>07:  y
+> 011=11: y
 > 
 > def:y   y
 > def:n   n
 > Failed: unknown variable "post" after "def:"
 > def:h_f n
 > def:h_f n
-> Failed: missing or misplaced { or }
+> Failed: curly-bracket problem in conditional yes/no parsing: 'yes' part did not start with '{'
+ remaining string is ':{y}{n}}'
 > 
 > exists: y
 > exists: n
 > isip:   y  1.2.3.4
 > isip4:  y  1.2.3.4
 > isip6:  n  1.2.3.4
+> isip:   n  ::1.2.3.256
+> isip4:  n  1.2.3.256
 > isip:   n  1:2:3:4
 > isip4:  n  1:2:3:4
 > isip6:  n  1:2:3:4
 > isip:   y  fe80::a00:20ff:fe86:a061
 > isip4:  n  fe80::a00:20ff:fe86:a061
 > isip6:  y  fe80::a00:20ff:fe86:a061
+> isip:   y  fe80::1.2.3.4
 > isip:   n  rhubarb
 > isip4:  n  rhubarb
 > isip6:  n  rhubarb
 > match_ip:        12 true
 > match_ip:        13 true
 > match_ip:        14 true
+> match_ip:        15 true
 > 
 > queue_running:  n
 > first_delivery: n
 > queue_running after or: y
 > first_delivery after or: y
 > 
+> # acl expansion condition
+> acl if: Y:(0) [] []
+> acl if: Y:(1) [argY] []
+> acl if: N:(2) [argN] [arg2]
+> Failed: error from acl "a_defer"
+> 
 > # Default values for both if strings
 > 
 > ${if eq{1}{1}}  >true<
 > a.b.c: *.b.c
 > ab.c:  *b.c
 > xyz:   ^X
-> Xyz:   ^X
-> Zyz:   ^Z
+> .Xyz:   ^X
+> .Zyz:   ^Z
 > a b:   "^a +b"
 > a  b:  "^a +b"
 > a:b:   lookup succeeded
 > a.b.c: *.b.c
 > ab.c:  *b.c
 > xyz:   ^X
-> Xyz:   ^X
-> Zyz:   ^Z
+> .Xyz:   ^X
+> .Zyz:   ^Z
 > a b:   "^a +b"
 > a  b:  "^a +b"
 > a:b:   lookup succeeded
 > a\:b:  ^a\\.+b
 > a\:Xb: ^a\\.+b
 > 
+> # Some tests of case-(in)dependence
+> 
+> .MiXeD-CD:  Data found for case-dependent MiXeD-CD
+> .MixeD-CD:  NOT FOUND
+> .MiXeD-Ncd: Data found for case-independent MiXeD-nCD
+> .MixeD-Ncd: Data found for case-independent MiXeD-nCD
+> 
 > # IP address (CIDR) lookups
 > 
 > 1.2.3.4:      data for 1.2.3.4
 > 2
 > 2
 > 2
-> Empty:<>
-> Empty:<>
+> empty:<>
+> empty:<>
 > <3>
 > <3>
-> Empty:<>
-> Empty:<>
+> empty:<>
+> empty:<>
 > no Z
 > no 4
 > Failed: "extract" failed and "fail" requested
 > Failed: first argument of "extract" must not be empty
 > b
 > 
+> a:b:c
+> Failed: missing '}' closing extract inside "map" item
+> a:b:c
+> 
 > # Translation
 > 
 > abcdea aaa xyz zbcdez
 > abcdea a       abcdea
 > abcdea abc z   zzzdez
 > 
+> # Boolean
+> "TrUe"                true      EXPECT: true
+> "FALSE"               false     EXPECT: false
+> " yes"                true      EXPECT: true
+> " no"                 false     EXPECT: false
+> "yes "                true      EXPECT: true
+> "-1"                  true     EXPECT: true
+> "0"                   false     EXPECT: false
+> "1"                   true      EXPECT: true
+> " 0 "                 false     EXPECT: false
+> " 1 "                 true      EXPECT: true
+> "1111111111111111111" true      EXPECT: true
+> "9"                   true      EXPECT: true
+> " "                   false     EXPECT: false
+> Failed: unrecognised boolean value "text"
+> Failed: unrecognised boolean value "text"
+> Failed: unrecognised boolean value "-text"
+> Failed: unrecognised boolean value "text"
+> Failed: unrecognised boolean value "text"
+> "00"                  false     EXPECT: false
+> "!true"               false     EXPECT: false
+> "!false"              true      EXPECT: true
+> 
+> "TrUe"                true      EXPECT: true
+> "FALSE"               false     EXPECT: false
+> " yes"                true      EXPECT: true
+> " no"                 false     EXPECT: false
+> "yes "                true      EXPECT: true
+> "-1"                  true      EXPECT: true
+> "0"                   false     EXPECT: false
+> "1"                   true      EXPECT: true
+> " 0 "                 false     EXPECT: false
+> " 1 "                 true      EXPECT: true
+> "1111111111111111111" true      EXPECT: true
+> "9"                   true      EXPECT: true
+> " "                   false     EXPECT: false
+> "text"                true      EXPECT: true
+> " text"               true      EXPECT: true
+> "text "               true      EXPECT: true
+> " text "              true      EXPECT: true
+> "00"                  true      EXPECT: true
+> "!true"               false     EXPECT: false
+> "!false"              true      EXPECT: true
+> 
 > # RFC 2047
 > 
 > abcd      abcd
 > <:abcd:>  =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=
 > <:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=
-> Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit?=
-> Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fac?= =?iso-8859-8?Q?t_this_one_will_go_over_the_150_character_limit?=
+> long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_?= =?iso-8859-8?Q?it_will_go_over_the_75-char_limit?=
+> long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_?= =?iso-8859-8?Q?it_will_go_over_the_75-char_limit_by_a_long_way=3B_in?= =?iso-8859-8?Q?_fact_this_one_will_go_over_the_150_character_limit?=
+> 
+> # RFC 2047 decode
 > 
+> abcd      abcd
+> <:abcd:>  <:abcd:>
+> <:ab cd:> <:ab cd:>
+> Long:      here we go: a string that is going to be encoded: it will go over the 75-char limit
+> Long:      here we go: a string that is going to be encoded: it will go over the 75-char limit by a long way; in fact this one will go over the 150 character limit
 > 
 > # UTF-8
 > 
 > 
 > # File insertion
 > 
-> Failed: missing or misplaced { or }
+> Failed: Not enough arguments for 'readfile' (min is 1)
 > abcde
 12345
 
@@ -467,37 +708,37 @@ xyz
 > abcd
 1234
 
-> RC=0
+> rc=0
 > 1
-> RC=0
+> rc=0
 > abcd
 1234
 
-> RC=0
+> rc=0
 > 2
-> RC=1
+> rc=1
 > abcd
 1234
 
-> RC=1
+> rc=1
 > N
-> RC=127
+> rc=127
 > >><<
-> RC=0
+> rc=0
 > 1!=2
-> RC=0
+> rc=0
 > 
 > # PRVS
 > 
-> prvs=userx/xxxxxxxxxx@test.ex
-> prvs=userx/xxxxxxxxxx@test.ex
-> prvs=userx/xxxxxxxxxx@test.ex
+> prvs=xxxxxxxxxx=userx@test.ex
+> prvs=xxxxxxxxxx=userx@test.ex
+> prvs=xxxxxxxxxx=userx@test.ex
 > 
 > # Syntax errors
 > 
-> Failed: prvs second argument must be a single digit
-> Failed: prvs second argument must be a single digit
-> Failed: prvs second argument must be a single digit
+> Failed: prvs third argument must be a single digit
+> Failed: prvs third argument must be a single digit
+> Failed: prvs third argument must be a single digit
 > 
 > # Correct checks; can't put explicit addresses in the tests, because they
 > # will change over time.
@@ -535,16 +776,75 @@ xyz
 > Failed: unknown condition "xya" inside "and{...}" condition
 > Failed: condition name expected, but found "${lookup{x}lsear" inside "and{...}" condition
 > Failed: missing } at end of string - could be header name not terminated by colon
+> Failed: curly-bracket problem in conditional yes/no parsing: did not close with '}'
+ remaining string is ''
+> Failed: missing or misplaced { or } - could be header name not terminated by colon
 > Failed: each subcondition inside an "or{...}" condition must be in its own {}
 > Failed: missing } at end of condition inside "or" group
 > Failed: unknown condition "yes" inside "or{...}" condition
 > Failed: non-digit after underscore in "substr_1_"
 > Failed: non-digit after underscore in "substr__3"
 > 
+> # Iterations: forany and forall
+> 
+> yes
+> yes
+> yes
+> no
+> yes
+> no
+> no
+> yes
+> yes
+> 
+> Failed: unknown condition "yes" inside "forany" condition
+> Failed: missing } at end of condition inside "forany"
+> 
+> yes
+> no
+> no
+> no
+> 
+> no
+> yes
+> yes
+> yes
+> 
+> # Expect yes
+> outer=yes item='' (unset)
+> 
+> # Expect no
+> outer=no
+> 
+> # Error inside nest - check message is helpful
+> Failed: missing } at end of condition inside "forall" inside "forany" condition
+> 
+> 
 > # Miscellaneous (for bug fixes, etc)
 > 
 > true
 > 
+> # Environment access
+> 
+> CALLER
+> correct
+> 
+> # JSON
+> 
+> "http://www.example.com/image/481989943"
+> 100
+> 943
+> 943
+> 
+> 59
+> 59
+> 
+> {"1":116, "2":943, "3":234}
+> expect: {"1":116, "2":943, "3":234}
+> 
+> {"1":116, "2":943, "3":234}
+> expect: {"1":116, "2":943, "3":234}
+> 
 > 
 > escape: B7·F2ò
 > 
@@ -554,6 +854,7 @@ xyz
 > yes
 > match_address:   no
 > 
+> -be Sender host name and address etc, all unset
 > -oMa  sender_host_address = 
 >       sender_host_port = 0
 > -oMaa sender_host_authenticated = 
@@ -565,6 +866,7 @@ xyz
 > -oMs  sender_host_name = 
 > -oMt  sender_ident = CALLER
 > 
+> -be Sender host name and address etc, all set except host name.
 > -oMa  sender_host_address = V4NET.0.0.1
 >       sender_host_port = 1234
 > -oMaa sender_host_authenticated = AAA
@@ -575,16 +877,20 @@ xyz
 > -oMr  received_protocol = special
 > -oMt  sender_ident = me
 > 
+> -be Sender host name explicitly set
 > -oMa  sender_host_address = V4NET.0.0.1
 >       sender_host_port = 1234
 > -oMs  sender_host_name = my.host.name
 > 
+> be Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
 > -oMs  sender_host_name = 
 >       host_lookup_failed = 1
 > 
+> -be Sender host name and protocol set by Sendmail-compatible option
 > -p  received_protocol = special
 > -p  sender_host_name = host.name
 > 
+> -be Sender host name and address etc, all set except host name
 > -oMa  sender_host_address = V4NET.0.0.1
 >       sender_host_port = 1234
 > -oMaa sender_host_authenticated = AAA
@@ -661,3 +967,6 @@ xyz
 > match_ip:        15 
 > match_ip:        16 
 > 
+> in list
+> in list
+>