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 local $Test::Builder::Level = $Test::Builder::Level + 1;
20 my ($head, $decl, $body) = eval {
21 $tikz->render(ref $set eq 'ARRAY' ? @$set : $set);
23 is $@, '', "$desc: no error";
25 unless (ref $exp eq 'ARRAY') {
26 $exp = [ split /\n/, $exp ];
28 unshift @$exp, '\begin{tikzpicture}';
29 push @$exp, '\end{tikzpicture}';
31 is_deeply $body, $exp, $desc;
37 is $@, '', 'creating a color mod doesn\'t croak';
43 is $@, '', 'creating a modded raw set doesn\'t croak';
45 check $foo, 'one modded raw set', <<'RES';
46 \draw [color=red] foo ;
52 is $@, '', 'creating a width mod doesn\'t croak';
57 is $@, '', 'adding another mod doesn\'t croak';
59 check $foo, 'one double modded raw set', <<'RES';
60 \draw [color=red,line width=4.0pt] foo ;
66 is $@, '', 're-adding an previously set mod doesn\'t croak';
68 check $foo, 'one triple modded raw set (with duplicates)', <<'RES';
69 \draw [color=red,line width=4.0pt] foo ;
72 my $bar = Tikz->raw('bar');
76 is $@, '', 'appending to a modded set doesn\'t croak';
78 check $foo, 'one triple modded sequence of raw sets (with duplicates)', <<'RES';
79 \begin{scope} [color=red,line width=4.0pt]