]> git.sesse.net Git - xml-template/blobdiff - tests/xml-diff.pl
All xml-diff errors should be fatal.
[xml-template] / tests / xml-diff.pl
index eba854f10e7a4e8bbfa475836e3c009d5a111315..eed51b40c153a23a5956a24e4aca0e8fca02d414 100644 (file)
@@ -69,10 +69,13 @@ sub compare {
                $d1 =~ s/\s+$//;
                $d2 =~ s/\s+$//;
 
-               if ($d1 ne $d2) {
-                       $d1 =~ s/\n/\\n/;
-                       $d2 =~ s/\n/\\n/;
+               # compress other whitespace
+               $d1 =~ s/\n/ /g;
+               $d1 =~ s/ +/ /g;
+               $d2 =~ s/\n/ /g;
+               $d2 =~ s/ +/ /g;
 
+               if ($d1 ne $d2) {
                        print STDERR "$nsuri1/$lname1 has differing textual content ('$d1' vs. '$d2')\n";
                        exit(1);
                }
@@ -139,11 +142,12 @@ sub compare_attr_list {
 
                if (!defined($attr2_found)) {
                        print STDERR "Attribute $nsuri1/$lname1 exists on one side but not the other\n";
-                       last;
+                       exit(1);
                }
 
                if ($attr1->getValue ne $attr2_found->getValue) {
                        print STDERR "Attribute $nsuri1/$lname1 has differing values\n";
+                       exit(1);
                }
        }
 }