| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use FindBin; |
| 4 |
use lib "$FindBin::Bin/../../../"; |
| 5 |
use Test::More; |
| 6 |
use t::Util; |
| 7 |
|
| 8 |
test('eval string with a semicolon', <<'END', {}, {'Test::Pod' => '1.00'}); |
| 9 |
eval "use Test::Pod 1.00;"; |
| 10 |
END |
| 11 |
|
| 12 |
test('eval string without a semicolon', <<'END', {}, {'Test::Pod' => '1.00'}); |
| 13 |
eval 'use Test::Pod 1.00'; |
| 14 |
END |
| 15 |
|
| 16 |
test('eval in qq{}', <<'END', {}, {'Test::Pod' => '1.00'}); |
| 17 |
eval qq{use Test::Pod 1.00} |
| 18 |
END |
| 19 |
|
| 20 |
test('eval in qq++', <<'END', {}, {'Test::Pod' => 0}); |
| 21 |
eval qq+use Test::Pod+ |
| 22 |
END |
| 23 |
|
| 24 |
test('eval in qq()', <<'END', {}, {'Test::Pod' => 0}); |
| 25 |
eval qq(use Test::Pod) |
| 26 |
END |
| 27 |
|
| 28 |
test('eval in q<>', <<'END', {}, {'Test::Pod' => 0}); |
| 29 |
eval q< use Test::Pod> |
| 30 |
END |
| 31 |
|
| 32 |
test('eval in q//', <<'END', {}, {'Test::Pod' => 0}); |
| 33 |
eval q/use Test::Pod/ |
| 34 |
END |
| 35 |
|
| 36 |
test('RT #19302', <<'END', {}, {'Test::Pod' => 0}); |
| 37 |
my $ver=1.22; |
| 38 |
eval "use Test::Pod $ver;" |
| 39 |
END |
| 40 |
|
| 41 |
test('ditto', <<'END', {}, {'Test::Pod' => 0}); |
| 42 |
my $ver=1.22; |
| 43 |
eval 'use Test::Pod $ver'; |
| 44 |
END |
| 45 |
|
| 46 |
test('no space between eval and string', <<'END', {}, {'Test::Pod' => '1.00'}); |
| 47 |
eval"use Test::Pod 1.00;"; |
| 48 |
END |
| 49 |
|
| 50 |
test('ditto', <<'END', {}, {'Test::Pod' => '1.00'}); |
| 51 |
eval'use Test::Pod 1.00'; |
| 52 |
END |
| 53 |
|
| 54 |
test('eval block', <<'END', {}, {'Test::Pod' => 0}); |
| 55 |
eval { use Test::Pod } |
| 56 |
END |
| 57 |
|
| 58 |
test('block in eval block', <<'END', {}, used(qw/Test::Pod Test::Pod::Coverage/)); |
| 59 |
eval { use Test::Pod; { use Test::Pod::Coverage; } } |
| 60 |
END |
| 61 |
|
| 62 |
test('block in eval block', <<'END', {}, used(qw/Test::Pod Test::Pod::Coverage/)); |
| 63 |
eval { { use Test::Pod; } use Test::Pod::Coverage } |
| 64 |
END |
| 65 |
|
| 66 |
done_testing; |