use strict;
use warnings;
-use Test::More tests => 11 + 2 * 15;
+use Test::More tests => 19 + 2 * 20;
use LaTeX::TikZ;
use LaTeX::TikZ::Formatter;
\end{scope}
RES
+my $set = Tikz->raw('wut');
+
+my $set_mod = eval {
+ $set->mod;
+};
+is $@, '', 'calling empty mod out of a set doesn\'t croak';
+is "$set_mod", "$set", 'calling empty mod out of a set returns the set';
+
+my $new = eval {
+ $set->mod(Tikz->raw_mod('raw1'));
+};
+is $@, '',
+ 'creating and applying a raw mod on a set in scalar context doesn\'t croak';
+is ref($new), 'LaTeX::TikZ::Set::Mod', 'new set is of the right kind';
+isnt "$new", "$set", 'new set is different from the old one';
+
+check $set, '', <<'RES';
+\draw wut ;
+RES
+
+check $new, '', <<'RES';
+\draw [raw1] wut ;
+RES
+
+eval {
+ $set->mod(Tikz->raw_mod('raw2'));
+ ();
+};
+is $@, '',
+ 'creating and applying a raw mod on a set in void context doesn\'t croak';
+is ref($new), 'LaTeX::TikZ::Set::Mod', 'new set is of the right kind';
+
+check $set, '', <<'RES';
+\draw [raw2] wut ;
+RES
+
+check $new, '', <<'RES';
+\draw [raw1] wut ;
+RES
+
my $baz = eval {
Tikz->raw('baz')
->mod($red);
\draw baz ;
\end{scope}
RES
+
+eval {
+ $baz->mod(Tikz->raw_mod($_)) for qw/raw2 raw3/;
+};
+is $@, '', 'creating and adding another raw mod doesn\'t croak';
+
+check $seq, 'mod covering 4', <<'RES';
+\begin{scope} [color=red,raw2]
+\begin{scope} [line width=4.0pt]
+\begin{scope} [raw1]
+\draw foo ;
+\draw bar ;
+\end{scope}
+\draw qux ;
+\end{scope}
+\draw [raw3] baz ;
+\end{scope}
+RES