From: Vincent Pit Date: Sun, 1 Aug 2010 22:35:16 +0000 (+0200) Subject: Replace LaTeX::TikZ::Set::Path::Elements by LaTeX::TikZ::Set::Op X-Git-Tag: v0.02~6 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=d9b3236d7adf9b87cebe8f956539469d42b9aef9;p=perl%2Fmodules%2FLaTeX-TikZ.git Replace LaTeX::TikZ::Set::Path::Elements by LaTeX::TikZ::Set::Op I guess the failures that led me to introduce this were caused by some loading order issue. --- diff --git a/lib/LaTeX/TikZ/Set/Path.pm b/lib/LaTeX/TikZ/Set/Path.pm index 86dfe44..d9a9799 100644 --- a/lib/LaTeX/TikZ/Set/Path.pm +++ b/lib/LaTeX/TikZ/Set/Path.pm @@ -18,9 +18,9 @@ our $VERSION = '0.01'; 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 @@ -41,13 +41,9 @@ The L objects that from the path. =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 { [ ] }, ); @@ -60,12 +56,12 @@ sub ops { @{$_[0]->_ops} } =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}, @_; diff --git a/t/10-set.t b/t/10-set.t index 190846c..4ddac3c 100644 --- a/t/10-set.t +++ b/t/10-set.t @@ -106,12 +106,10 @@ sub failed_valid { 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 { @@ -136,5 +134,5 @@ 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';