provide warnings for missing optional fields
authorJason Etheridge <jason@EquinoxOLI.org>
Mon, 28 Nov 2022 04:24:47 +0000 (23:24 -0500)
committerJason Etheridge <jason@EquinoxOLI.org>
Mon, 28 Nov 2022 04:24:47 +0000 (23:24 -0500)
t/SIPtest.pm

index 8e86524..7e03c4b 100644 (file)
@@ -298,6 +298,9 @@ sub one_msg {
                 }
                 return;
             }
+            if (!$ftest->{required} && !exists($fields{$field})) {
+                diag("WARNING: $test->{id}: optional field '$field' not found in msg " . substr($resp,0,2));
+            }
 
             if (exists($fields{$field}) && (decode_utf8($fields{$field}) !~ $ftest->{pat})) {
                 diag("Field '$field' pattern '$ftest->{pat}' fails to match value '$fields{$field}' in message '$resp'");