-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwith-version.t
46 lines (37 loc) · 938 Bytes
/
with-version.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [ 'diag', 'done_testing' ];
use Test::Needs {
'Cpanel::JSON::XS' => 4.19,
'Getopt::Long' => 2.40,
'LWP::UserAgent' => 5.00,
};
my ( $doc, $log ) = doc( filename => 'test-data/with-version.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Cpanel::JSON::XS 4.19 qw( decode_json );
use Getopt::Long 2.40 qw( GetOptions );
use LWP::UserAgent 5.00 ();
use Test::Script 1.27 qw(
script_compiles
script_runs
script_stderr_is
script_stderr_like
);
my $foo = decode_json( { foo => 'bar' } );
my @foo = GetOptions();
script_compiles();
script_runs();
script_stderr_is();
script_stderr_like();
EOF
eq_or_diff(
$doc->tidied_document,
$expected,
'versions preserved'
) || do { require Data::Dumper; diag Data::Dumper::Dumper($log); };
done_testing();