X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F30-functor.t;h=a5952efe26f1f09053a3e17d00aa50586a68ab59;hb=1c53f7e28198adfb2905667acd5741f163832d7b;hp=bdade4b6c6257b1686636a263258de9d3e00582f;hpb=b212ec02c4010c5200e7741d432397bfede7ca50;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/t/30-functor.t b/t/30-functor.t index bdade4b..a5952ef 100644 --- a/t/30-functor.t +++ b/t/30-functor.t @@ -7,29 +7,13 @@ use Test::More tests => 10 + 2 * 7; use LaTeX::TikZ; -my $tikz = Tikz->formatter( +use lib 't/lib'; +use LaTeX::TikZ::TestHelper; + +using 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); - }; - is $@, '', "$desc: no error"; - - unless (ref $exp eq 'ARRAY') { - $exp = [ split /\n/, $exp ]; - } - unshift @$exp, '\begin{tikzpicture}'; - push @$exp, '\end{tikzpicture}'; - - is_deeply $body, $exp, $desc; -} - my $translate = eval { Tikz->functor( 'LaTeX::TikZ::Set::Point' => sub { @@ -138,7 +122,7 @@ $special = eval { '+LaTeX::TikZ::Mod' => sub { die "mod\n" }, '+LaTeX::TikZ::Set' => sub { die "set\n" }, 'LaTeX::TikZ::Set::Point' => sub { Tikz->point(7) }, - 'LaTeX::TikZ::Set::Op' => sub { Tikz->raw('moo') }, + 'LaTeX::TikZ::Set::Path' => sub { Tikz->raw('moo') }, ); }; is $@, '', 'creating a special functor with + and normal rules doesn\'t croak'; @@ -158,7 +142,7 @@ check $res, 'the result of the special functor', <<'RES'; \draw moo ; RES -$tikz = eval { +using eval { Tikz->formatter( origin => [ -1, 1 ], );