The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use strict;
use warnings;
use open qw(:std :encoding(UTF-8));
use Test::Output qw(stdout_is);
use Test::More tests => 2;
use App::perlhl;

my $expected = do { local $/; <DATA> };

stdout_is(
    sub { App::perlhl->new('ansi')->run('highlight', ('t/testfile')) },
    $expected,
    'ANSI highlighting done right'
);

my $system = `$^X bin/perlhl t/testfile 2>&1`;
is $system, $expected, 'perlhl does the same thing';

__DATA__
#!/usr/bin/env perl
use strict;
use warnings;

my $scalar = 'hello';
my $newline = "\n";
my @array = qw(one two three);
my $string = q{Hello, world!};
if ($scalar) {
    my $ver  = $File::Basename::VERSION;
    my $ver2 = File::Basename->VERSION();
    print ($ver == $ver2 ? 'ok' : 'notok');
}
my %hash = @ARGV if @ARGV % 2 == 0;
while (<>) {
    print if m/\Q$scalar\E|hi/i;
}
close *STDOUT;