]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - t/12-geo.t
Factor the check() test function in an helper test module
[perl/modules/LaTeX-TikZ.git] / t / 12-geo.t
index f36d00273163957417ea3bd1b3923e853d5560ba..c1caa3e31b169dcbbe941579823f79392a2a3adb 100644 (file)
@@ -9,29 +9,13 @@ use Math::Complex;
 
 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;
-}
-
 sub failed_valid {
  my ($tc) = @_;
  qr/Validation failed for '\Q$tc\E'/;
@@ -211,7 +195,7 @@ like $@, failed_valid('__ANON__'),
 
 # Arc
 
-$tikz = Tikz->formatter(
+using Tikz->formatter(
  format => "%.03f"
 );