File: 14-noeof.t

package info (click to toggle)
libfile-loadlines-perl 1.047-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: perl: 545; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 569 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! perl

# Test return of lines in array.

use strict;
use warnings;
use Test::More tests => 3;
use utf8;

use File::LoadLines;

-d "t" && chdir "t";

# Testing a missing final line terminator.
my $data = "first\r\nsecond\r\nthird";
my @lines = loadlines( \$data, { chomp => 0 } );
is( scalar(@lines), 3, "three lines CRLF" );
$data = "first\rsecond\rthird";
@lines = loadlines( \$data, { chomp => 0 } );
is( scalar(@lines), 3, "three lines CR" );
$data = "first\nsecond\nthird";
@lines = loadlines( \$data, { chomp => 0 } );
is( scalar(@lines), 3, "three lines NL" );