File: 100-internal--read-shebang.t

package info (click to toggle)
libtest-compile-perl 3.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: perl: 816; makefile: 2; sh: 1
file content (31 lines) | stat: -rw-r--r-- 764 bytes parent folder | download
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
#!perl

use strict;
use warnings;

use Test::More;
use Test::Compile::Internal;

my $internal = Test::Compile::Internal->new();
my $perl;

# Given: a file without a shebang
# When: call _read_shebang()
$perl = $internal->_read_shebang('t/scripts/datafile');
# Then
ok(!$perl, "The datafile doesn't look like a perl program");

# Given: a file with a perl shebang
# When: call _read_shebang()
$perl = $internal->_read_shebang('t/scripts/perlscript');
# Then
ok($perl, "The perlscript does look like a perl program");

# Given: a file that can't be read..
# When: call _read_shebang()
$perl = $internal->_read_shebang('t/scripts/i-dont-exist');
# Then: Gotta assume it's not perl
ok(!$perl, "if you can't read a file, then it's not perl");

$internal->done_testing