--- /dev/null
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 6 + 2 * 4;
+
+use LaTeX::TikZ;
+use LaTeX::TikZ::Formatter;
+
+my $tikz = LaTeX::TikZ::Formatter->new(
+ format => '%d',
+);
+
+sub check {
+ my ($set, $desc, $exp) = @_;
+
+ 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 $red = eval {
+ Tikz->color('red');
+};
+is $@, '', 'creating a color mod doesn\'t croak';
+
+my $foo = eval {
+ Tikz->raw('foo')
+ ->mod($red)
+};
+is $@, '', 'creating a modded raw set doesn\'t croak';
+
+check $foo, 'one modded raw set', <<'RES';
+\draw [color=red] foo ;
+RES
+
+my $width = eval {
+ Tikz->width(25);
+};
+is $@, '', 'creating a width mod doesn\'t croak';
+
+eval {
+ $foo->mod($width);
+};
+is $@, '', 'adding another mod doesn\'t croak';
+
+check $foo, 'one double modded raw set', <<'RES';
+\draw [color=red,line width=4.0pt] foo ;
+RES
+
+eval {
+ $foo->mod($red);
+};
+is $@, '', 're-adding an previously set mod doesn\'t croak';
+
+check $foo, 'one triple modded raw set (with duplicates)', <<'RES';
+\draw [color=red,line width=4.0pt] foo ;
+RES
+
+my $bar = Tikz->raw('bar');
+eval {
+ $foo->add($bar);
+};
+is $@, '', 'appending to a modded set doesn\'t croak';
+
+check $foo, 'one triple modded sequence of raw sets (with duplicates)', <<'RES';
+\begin{scope} [color=red,line width=4.0pt]
+\draw foo ;
+\draw bar ;
+\end{scope}
+RES