1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 4;
7use Parse::ErrorString::Perl;
8use File::Spec;
9
10my $parser = Parse::ErrorString::Perl->new;
11
12my $path_script = File::Spec->catfile( $INC[0], 'error.pl' );
13my $msg_short_script = 'Use of uninitialized value $empty in length at ' . $path_script . ' line 6.';
14
15my @errors_short_script = $parser->parse_string($msg_short_script);
16is( scalar(@errors_short_script),  1,          'msg_short_script results' );
17is( $errors_short_script[0]->file, 'error.pl', 'msg_short_script short path' );
18
19our @INC;
20my $path_module = File::Spec->catfile( $INC[0], 'Error.pm' );
21my $msg_short_module = 'Use of uninitialized value $empty in length at ' . $path_module . ' line 6.';
22
23my @errors_short_module = $parser->parse_string($msg_short_module);
24is( scalar(@errors_short_module),  1,          'msg_short_module results' );
25is( $errors_short_module[0]->file, 'Error.pm', 'msg_short_module short path' );
26