use strict;
use warnings;
-use Test::More tests => 9 + 2 * 6;
+use Test::More tests => 12 + 2 * 7;
use LaTeX::TikZ;
use LaTeX::TikZ::Formatter;
\draw foo ;
RES
+sub failed_valid {
+ my ($tc) = @_;
+ 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]]'),
+ 'creating a path that contains a sequence croaks';
+
my $path = eval {
Tikz->path($foo, $bar, $baz);
};
is $@, '', 'creating a path set doesn\'t croak';
-check [ $path, $path ], 'two identical path sets', <<'RES';
-\draw foo bar baz ;
+check $path, 'one path set', <<'RES';
\draw foo bar baz ;
RES
+
+eval {
+ $path->add($foo);
+};
+is $@, '', 'adding something to a path set doesn\'t croak';
+
+check [ $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'),
+ 'adding a sequence to a path croaks';