t2/relative_paths.t
raw| 1 | use Test2::V0; |
| 2 | use File::Spec; |
| 3 | # HARNESS-DURATION-SHORT |
| 4 | |
| 5 | my $path = File::Spec->canonpath('t2/relative_paths.t'); |
| 6 | |
| 7 | skip_all "This test must be run from the project root." |
| 8 | unless -f $path; |
| 9 | |
| 10 | is(__FILE__, $path, "__FILE__ is relative"); |
| 11 | is(__FILE__, $0, "\$0 is relative"); |
| 12 | |
| 13 | sub { |
| 14 | my ($pkg, $file) = caller(0); |
| 15 | is($file, $path, "file in caller is relative"); |
| 16 | }->(); |
| 17 | |
| 18 | done_testing; |