The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

#!/usr/bin/env perl
use strict;
my $table = Algorithm::Diff::HTMLTable->new;
{
is $table->_read_file, undef, 'No file at all';
is $table->_read_file({}), undef, 'Hashref is not accepted';
is_deeply [$table->_read_file(['Test']) ], ['Test'], 'Arrayref - handled as lines';
is_deeply [$table->_read_file([]) ], [], 'Arrayref - handled as lines';
is $table->_read_file( '/does/not/exist/algorithm_diff_htmltable.t' ), undef;
}
{
my $fh = File::Temp->new;
binmode $fh, ':encoding(utf-8)';
print $fh "Hallo\nTest";
my $name = $fh->filename;
close $fh;
is_deeply [ $table->_read_file( $name ) ], ["Hallo\n", "Test"];
}
done_testing();