WARC
view release on metacpan or search on metacpan
t/WARC-Record-Logical-Block.t view on Meta::CPAN
169170171172173174175176177178179180181182183184185186187188189
## record: at EOF
ok((not
defined
scalar
<
$xh
>),
'read record at eof'
);
ok((
eof
$xh
),
'handle still at eof after read at eof'
);
note_handle_state
$xh
;
}
note(
'*'
x 60);
# Verify READLINE (paragraph)
{
local
$/ =
''
;
# select paragraph mode
my
$xh
= make_test_handle
"abc\ndef\n\n\n\nghi\njkl\n\n"
,
"mno\npqr\nstu\n\nvwx\nyz"
,
"0\n\n123\n456"
;
note_handle_state
$xh
;
## paragraph: within segment
is(
scalar
<
$xh
>,
"abc\ndef\n\n\n\n"
,
'read paragraph within segment'
);
note_handle_state
$xh
;
## paragraph: to segment boundary
is(
scalar
<
$xh
>,
"ghi\njkl\n\n"
,
t/WARC-Record-Logical-Block.t view on Meta::CPAN
348349350351352353354355356357358359360361362363364365366367368369370371372
'read mcdcop line with false prefix and data to delimiter'
);
## ... to EOF without delimiter
is(
scalar
<
$xh
>,
'wxyz'
,
'read mcdcop line to eof without delimiter'
);
ok((
eof
$xh
),
'filehandle now at eof'
);
}
# Verify READLINE (mixed modes)
{
my
$xh
;
{
local
$/ =
''
;
# ensure that handle is usable in paragraph mode
$xh
= make_test_handle
"abc\n"
;
}
is(
scalar
<
$xh
>,
"abc\n"
,
'read line to eof'
);
local
$/ =
''
;
# select paragraph mode
ok((not
defined
scalar
<
$xh
>),
'read paragraph at eof'
);
$/ = \4;
# select record mode
$xh
= make_test_handle
'1234'
;
is(
scalar
<
$xh
>,
'1234'
,
'read record to eof'
);
$/ =
"\n"
;
# select line mode
ok((not
defined
scalar
<
$xh
>),
'read line at eof'
);
$xh
= make_test_handle
"1234\n"
;
is(
scalar
<
$xh
>,
"1234\n"
,
'read line to eof for slurp'
);
( run in 0.250 second using v1.01-cache-2.11-cpan-94b05bcf43c )