Skip to content

Commit a71cda6

Browse files
author
SReject
committed
Update tests
1 parent cea5e9d commit a71cda6

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

test/JSON for mIRC - Tests.mrc

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,21 +1329,37 @@ alias -l jfm_test {
13291329
var %cert_re = /^The certificate authority is invalid or incorrect/
13301330
inc %testnum
13311331
JSONOpen -u jfm_test %cert_url
1332-
if (!$regex($JSONError, %cert_re)) {
1333-
return %testnum /JSONOpen -u %cert_url : Request reported unexpected error: $v2
1332+
%Err = $JSONError
1333+
1334+
if ($null == %err) {
1335+
return %testnum /JSONOpen -u %cert_url : Request failed to report an error
13341336
}
13351337
$(%echo,2) /JSONOpen -u %cert_url : Passed Check
13361338
JSONClose jfm_test
13371339

13381340
;; Attempt to use invalid SSL cert with i switch
13391341
inc %testnum
13401342
JSONOpen -ui jfm_test %cert_url
1341-
if ($regex($JSONError, %cert_re)) {
1342-
return %testnum /JSONOpen -ui %cert_url : Request reported error: $v2
1343+
%Err = $JSONError
1344+
if ($null == %Err) {
1345+
return %testnum /JSONOpen -ui %cert_url : Request failed to report SSL Cert error
13431346
}
13441347
$(%echo,2) /JSONOpen -ui %cert_url : Passed Check
13451348
JSONClose jfm_test
13461349

1350+
;; check that -uR does not follow redirects
1351+
inc %testnum
1352+
JSONOpen -UR jfm_test https://forums.mirc.com
1353+
%Err = $JSONError
1354+
if ($null !== %err) {
1355+
return %testnum /JSONOpen -UR: Request reported error: %Err
1356+
}
1357+
if (3?? !iswm $JSON(jfm_test).httpStatus) {
1358+
return %testnum /JSONOpen -UR: Request did not stop at the first redirect : $JSON(jfm_test).httpStatus $JSON(jfm_test).httpStatusText
1359+
}
1360+
$(%echo,2) /JSONOpen -UR : Passed Check
1361+
JSONClose jfm_test
1362+
13471363
}
13481364

13491365

0 commit comments

Comments
 (0)