#!/usr/bin/perl
BEGIN { plan
tests
=> 13 }
BEGIN {
unshift
@INC
,
'../lib'
if
$constant::declared
{
'main::standalone'
} }
our
$tempfile
=
"$0.tmp"
;
{
open
my
$fh
,
">$tempfile"
;
close
$fh
;
my
$data
= Data::Rlist::
read
(
$tempfile
);
ok(not
defined
$data
);
unlink
(
$tempfile
);
$data
=
eval
{ Data::Rlist::
read
(
$tempfile
) };
ok(not
defined
$data
);
ok((not
defined
ReadData(\
" "
)) && Data::Rlist::missing_input());
ok((not
defined
ReadData(\
";"
)) && Data::Rlist::missing_input());
ok((not
defined
ReadData(\
","
)) && Data::Rlist::missing_input());
ok(
ref
(ReadData(\
"()"
)) =~ /ARRAY/);
ok(
ref
(ReadData(\
"{}"
)) =~ /HASH/);
ok(!Data::Rlist::missing_input());
ok(
exists
ReadData(\
"\"\""
)->{
''
});
ok(
exists
ReadData(\
"0"
)->{0});
ok(
exists
ReadData(\
"\"0\""
)->{0});
ok(
exists
ReadData(\
"-x "
)->{-x});
ok(ReadData(\
"x = 5;"
)->{x} == 5);
}
unlink
$tempfile
;