#!/usr/bin/perl

use Test::More no_plan;
use strict;
use warnings;

use lib "t";

use Octothorpe;
use XML::LibXML;
use XMLTests;

my @eg_filenames = map {"t/$_"}
	sort {$a cmp $b} XMLTests::find_tests("xml/valid");

my $valid_foo = Octothorpe->parse_file( shift @eg_filenames );
ok($valid_foo, "parse_file('filename')");

open FH, "<", shift @eg_filenames;
$valid_foo = Octothorpe->parse_fh( \*FH );
ok($valid_foo, "parse_fh(\*FOO)");

eval {Octothorpe->parse_fh( 'blah' )};
like($@, qr{Parameter #1 \("blah"\) to PRANG::Graph::parse_fh did not pass the 'checking type constraint for GlobRef' callback}, 
    "parse_fh parameter validated");

my $parser = XML::LibXML->new;
my $dom = $parser->parse_file( shift @eg_filenames );
$valid_foo = Octothorpe->from_dom( $dom );
ok($valid_foo, "from_dom(\$dom)");
#!/usr/bin/perl

use Test::More no_plan;
use strict;
use warnings;

use lib "t";

use Octothorpe;
use XML::LibXML;
use XMLTests;

my @eg_filenames = map {"t/$_"}
	sort {$a cmp $b} XMLTests::find_tests("xml/valid");

my $valid_foo = Octothorpe->parse_file( shift @eg_filenames );
ok($valid_foo, "parse_file('filename')");

open FH, "<", shift @eg_filenames;
$valid_foo = Octothorpe->parse_fh( \*FH );
ok($valid_foo, "parse_fh(\*FOO)");

{
    eval {Octothorpe->parse_fh( 'blah' )};
    my $error = $@;
    ok( ($error =~ qr{Parameter #1 \("blah"\) to PRANG::Graph::parse_fh did not pass the 'checking type constraint for GlobRef' callback})
    ||  ($error =~ qr{Parameter #1 does not pass the type constraint because: Validation failed for 'GlobRef' with value "blah"}) );
}

my $parser = XML::LibXML->new;
my $dom = $parser->parse_file( shift @eg_filenames );
$valid_foo = Octothorpe->from_dom( $dom );
ok($valid_foo, "from_dom(\$dom)");

Fix test for backwards incompatible dep change
Fix test for backwards incompatible dep change

See: https://github.com/moose/MooseX-Params-Validate/blob/f60f0e4c2d8716193f1b4adca14a19411b826519/Changes#L10

Resolves(?): https://rt.cpan.org/Public/Bug/Display.html?id=110744