6 use Test::More tests => 8 + 2 * 8;
12 my $tikz = Tikz->formatter(
17 my ($set, $desc, $exp) = @_;
19 local $Test::Builder::Level = $Test::Builder::Level + 1;
21 my ($head, $decl, $body) = eval {
22 $tikz->render(ref $set eq 'ARRAY' ? @$set : $set);
24 is $@, '', "$desc: no error";
26 unless (ref $exp eq 'ARRAY') {
27 $exp = [ split /\n/, $exp ];
29 unshift @$exp, '\begin{tikzpicture}';
30 push @$exp, '\end{tikzpicture}';
32 is_deeply $body, $exp, $desc;
35 my $z = Math::Complex->make(1, 2);
40 is $@, '', 'creating a point from a Math::Complex object doesn\'t croak';
42 check $p, 'a point from a Math::Complex object', <<'RES';
49 is $@, '', 'creating a point from a Math::Complex constant object doesn\'t croak';
51 check $p, 'a point from a constant Math::Complex object', <<'RES';
58 is $@, '', 'creating a point from nothing doesn\'t croak';
60 check $p, 'a point from nothing', <<'RES';
67 is $@, '', 'creating a point from a numish constant doesn\'t croak';
69 check $p, 'a point from a numish constant', <<'RES';
76 is $@, '', 'creating a point from two numish constants doesn\'t croak';
78 check $p, 'a point from two numish constants', <<'RES';
85 is $@, '', 'creating a point from an array ref doesn\'t croak';
87 check $p, 'a point from an array ref', <<'RES';
97 is $@, '', 'creating a labeled point from an array ref doesn\'t croak';
99 check $p, 'a labeled point', <<'RES';
100 \draw (1cm,-1cm) [fill] circle (0.4pt) node[scale=0.20,above] {foo} ;
107 pos => 'below right',
111 'creating a labeled positioned point from an array ref doesn\'t croak';
113 check $p, 'a labeled positioned point', <<'RES';
114 \draw (2cm,-2cm) [fill] circle (0.4pt) node[scale=0.20,below right] {bar} ;