2433d01990cd94d4112fb338b2084227b96d2f7a
[catagits/Test-EOL.git] / t / 11-all.t
1 use strict;
2
3 use Test::EOL;
4 use FindBin qw/$Bin/;
5
6 use File::Temp qw( tempdir tempfile );
7
8 all_perl_files_ok("$Bin/../lib");
9
10 eol_unix_ok( $0, "$0 is unix eol" );
11
12 my $file1 = make_file1();
13 eol_unix_ok( $file1 );
14
15 my $file2 = make_file2();
16 eol_unix_ok( $file2 );
17
18 my $file3 = make_file3();
19 eol_unix_ok( $file3 );
20
21 unlink foreach ( $file1, $file2, $file3 );
22
23 sub make_file1 {
24   my ($fh, $filename) = tempfile();
25   print $fh <<'DUMMY';
26 #!/usr/bin/perl -w
27
28 =pod
29
30 =head1 NAME
31
32 This test script doesn't do anything.
33
34 =cut
35
36 sub main {
37     my ($name) = @_;
38     print "Hello $name!\n";
39 }
40
41 DUMMY
42   return $filename;
43 }
44
45 sub make_file2 {
46   my ($fh, $filename) = tempfile();
47   print $fh <<'DUMMY';
48 #!/usr/bin/perl -w
49
50 =pod
51
52 =head1 NAME
53
54 This test script doesn't do anything.
55
56 =cut
57
58 sub main {
59     my ($name) = @_;
60     print "Hello $name!\n";
61 }
62
63 DUMMY
64   return $filename;
65 }
66
67 sub make_file3 {
68   my ($fh, $filename) = tempfile();
69   print $fh <<'DUMMY';
70 package My::Test;
71
72 use strict;
73 use warnings;
74
75 sub new {
76     my ($class) = @_;
77     my $self = bless {}, $class;
78     return $self;
79 }
80
81 1;
82 __END__
83 DUMMY
84   return $filename;
85 }
86