use LaTeX::TikZ::Interface;
use LaTeX::TikZ::Functor;
+use LaTeX::TikZ::Tools;
+
use Any::Moose;
-use Any::Moose 'Util::TypeConstraints'
- => [ qw/subtype as where find_type_constraint/ ];
=head1 RELATIONSHIPS
=cut
-subtype 'LaTeX::TikZ::Set::Path::Elements'
- => as 'Object'
- => where { $_->does('LaTeX::TikZ::Set::Op') };
-
has '_ops' => (
is => 'ro',
- isa => 'Maybe[ArrayRef[LaTeX::TikZ::Set::Path::Elements]]',
+ isa => 'Maybe[ArrayRef[LaTeX::TikZ::Set::Op]]',
init_arg => 'ops',
default => sub { [ ] },
);
=cut
-my $ltspe_tc = find_type_constraint('LaTeX::TikZ::Set::Path::Elements');
+my $ltso_tc = LaTeX::TikZ::Tools::type_constraint('LaTeX::TikZ::Set::Op');
sub add {
my $set = shift;
- $ltspe_tc->assert_valid($_) for @_;
+ $ltso_tc->assert_valid($_) for @_;
push @{$set->_ops}, @_;
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 {
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';