]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - t/30-functor.t
Factor the check() test function in an helper test module
[perl/modules/LaTeX-TikZ.git] / t / 30-functor.t
index bdade4b6c6257b1686636a263258de9d3e00582f..64d7d4b6023e61c398fdd5fb09864dda41b6652c 100644 (file)
@@ -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 {
@@ -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 ],
  );