6 use Test::More tests => 6 + 2 * 4;
9 use LaTeX::TikZ::Formatter;
11 my $tikz = LaTeX::TikZ::Formatter->new(
16 my ($set, $desc, $exp) = @_;
18 my ($head, $decl, $body) = eval {
19 $tikz->render(ref $set eq 'ARRAY' ? @$set : $set);
21 is $@, '', "$desc: no error";
23 unless (ref $exp eq 'ARRAY') {
24 $exp = [ split /\n/, $exp ];
26 unshift @$exp, '\begin{tikzpicture}';
27 push @$exp, '\end{tikzpicture}';
29 is_deeply $body, $exp, $desc;
35 is $@, '', 'creating a color mod doesn\'t croak';
41 is $@, '', 'creating a modded raw set doesn\'t croak';
43 check $foo, 'one modded raw set', <<'RES';
44 \draw [color=red] foo ;
50 is $@, '', 'creating a width mod doesn\'t croak';
55 is $@, '', 'adding another mod doesn\'t croak';
57 check $foo, 'one double modded raw set', <<'RES';
58 \draw [color=red,line width=4.0pt] foo ;
64 is $@, '', 're-adding an previously set mod doesn\'t croak';
66 check $foo, 'one triple modded raw set (with duplicates)', <<'RES';
67 \draw [color=red,line width=4.0pt] foo ;
70 my $bar = Tikz->raw('bar');
74 is $@, '', 'appending to a modded set doesn\'t croak';
76 check $foo, 'one triple modded sequence of raw sets (with duplicates)', <<'RES';
77 \begin{scope} [color=red,line width=4.0pt]