use Test::More tests => 12 + 2 * 7;
use LaTeX::TikZ;
-use LaTeX::TikZ::Formatter;
-my $tikz = LaTeX::TikZ::Formatter->new(
+my $tikz = Tikz->formatter(
format => '%d',
);
sub check {
my ($set, $desc, $exp) = @_;
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
my ($head, $decl, $body) = eval {
$tikz->render(ref $set eq 'ARRAY' ? @$set : $set);
};
qr/Validation failed for '\Q$tc\E'/;
}
-my $err_path = qr/does not pass the type constraint because: Validation failed for 'Maybe\[ArrayRef\[LaTeX::TikZ::Set::Path::Elements\]\]/;
-
eval {
Tikz->path($foo, $seq2);
};
-like $@, failed_valid('Maybe[ArrayRef[LaTeX::TikZ::Set::Path::Elements]]'),
+like $@, failed_valid('Maybe[ArrayRef[LaTeX::TikZ::Set::Op]]'),
'creating a path that contains a sequence croaks';
my $path = eval {
};
is $@, '', 'adding something to a path set doesn\'t croak';
-check [ $path, $path ], 'two identical path sets', <<'RES';
+check Tikz->seq($path, $path), 'two identical path sets', <<'RES';
\draw foo bar baz foo ;
\draw foo bar baz foo ;
RES
eval {
$path->add($seq2);
};
-like $@, failed_valid('LaTeX::TikZ::Set::Path::Elements'),
+like $@, failed_valid('LaTeX::TikZ::Set::Op'),
'adding a sequence to a path croaks';