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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../../../";
use Test::More;
use t::Util;
test('eval string with a semicolon', <<'END', {}, {'Test::Pod' => '1.00'});
eval "use Test::Pod 1.00;";
END
test('eval string without a semicolon', <<'END', {}, {'Test::Pod' => '1.00'});
eval 'use Test::Pod 1.00';
END
test('eval in qq{}', <<'END', {}, {'Test::Pod' => '1.00'});
eval qq{use Test::Pod 1.00}
END
test('eval in qq++', <<'END', {}, {'Test::Pod' => 0});
eval qq+use Test::Pod+
END
test('eval in qq()', <<'END', {}, {'Test::Pod' => 0});
eval qq(use Test::Pod)
END
test('eval in q<>', <<'END', {}, {'Test::Pod' => 0});
eval q< use Test::Pod>
END
test('eval in q//', <<'END', {}, {'Test::Pod' => 0});
eval q/use Test::Pod/
END
test('RT #19302', <<'END', {}, {'Test::Pod' => 0});
my $ver=1.22;
eval "use Test::Pod $ver;"
END
test('ditto', <<'END', {}, {'Test::Pod' => 0});
my $ver=1.22;
eval 'use Test::Pod $ver';
END
test('no space between eval and string', <<'END', {}, {'Test::Pod' => '1.00'});
eval"use Test::Pod 1.00;";
END
test('ditto', <<'END', {}, {'Test::Pod' => '1.00'});
eval'use Test::Pod 1.00';
END
test('eval block', <<'END', {}, {'Test::Pod' => 0});
eval { use Test::Pod }
END
test('block in eval block', <<'END', {}, used(qw/Test::Pod Test::Pod::Coverage/));
eval { use Test::Pod; { use Test::Pod::Coverage; } }
END
test('block in eval block', <<'END', {}, used(qw/Test::Pod Test::Pod::Coverage/));
eval { { use Test::Pod; } use Test::Pod::Coverage }
END
done_testing;
|