{
my
$D
= [ [ 1,
"3 "
], [ 2, 4 ] ];
write_data(
"./t/temp/gnuplot_test.csv"
,
$D
);
is(
read_file(
"./t/temp/gnuplot_test.csv"
, {
binmode
=>
":utf8"
} ),
"1\t\"3 \"\n2\t4"
,
'Writes gnuplot file correctly'
);
my
$d
= [ [
'"a'
] ];
dies_ok { write_data(
"./t/temp/gnuplot_test.csv"
,
$d
) }
'Does not accept "'
;
throws_ok { write_data(
"./t/temp/gnuplot_test.csv"
, [] ) }
qr/Non-empty/
,
'Must contain data'
;
throws_ok { write_data(
"./t/temp/gnuplot_test.csv"
, [ [] ] ) }
qr/more than one/
,
'Must contain labels'
;
}
{
my
$d
= [ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ] ];
my
$f
= dirname(__FILE__) .
"/test.png"
;
exec_commands(
qq{
set terminal png
set output "$f"
plot __DATA__ u 1:2
}
,
$d
);
ok( -e
$f
,
'Creates an image file'
);
`rm -f
$f
`;
}