Commits

Shlomi Fish committed 7d5549e

Convert 61error.t to Test::More.

  • Participants
  • Parent commits 9f5cb3c

Comments (0)

Files changed (1)

 use strict;
 use warnings;
 
-use Test;
-BEGIN { use XML::LibXML;
-        if ( XML::LibXML::HAVE_STRUCT_ERRORS() ) {
-            plan tests => 3;
-        }else{
-            plan tests => 1;
-        }
+use Test::More tests => 3;
+use XML::LibXML;
+
+if (! XML::LibXML::HAVE_STRUCT_ERRORS() ) {
+    plan skip_all => 'XML::LibXML does not have struct errrors.';
 }
 
 use XML::LibXML::Error;
 <X></Y>
 EOX
 
-    eval {
-        my $doc = $p->parse_string( $xmlstr );
-    };
-    if ( $@ ) {
-        if ( ref( $@ ) ) {
-            ok(ref($@), "XML::LibXML::Error");
-            ok($@->domain(), "parser");
-            ok($@->line(), 1);
-            # warn "se: ", $@;
-    
-        }
-        else {
-            # warn "me: ", $@;
-            ok(1);
-        }
-    }
+eval {
+    my $doc = $p->parse_string( $xmlstr );
+};
 
-
-
+my $err = $@;
+# TEST
+isa_ok ($err, "XML::LibXML::Error", 'Exception is of type error.');
+# TEST
+is ($err->domain(), 'parser', 'Error is in the parser domain');
+# TEST
+is ($err->line(), 1, 'Error is on line 1.');
+# warn "se: ", $@;