13
t/wrap.pl -c # for create
15
t/wrap.pl -x # for extract
23
my @opt = <<'=back' =~ /B<-(\S+)>/g;
27
Wrap the test files into wrapper file
31
Path to the wrapper file. Defaults to t/wrapped-tests.bin.
39
Unwrap the test files from the wrapper file
45
The t/ directory contains tests for different line endings. To
46
distribute these tests we wrap them into a Data::Dumper file to avoid
47
problems on distribution verification.
49
Called with -c we create the wrapping file. Called with -x we unwrap
50
the files and install them into place.
52
The test t/3-verify.t calls us with -x.
54
When anything changes that breaks 3-verify.t, then the procedure to
55
create new test files is something like the following:
59
(2) edit files in t/test*; take care that the files in test-datlf*
60
have Unix line endings and the files in test-datcrlf* have DOS
61
line endings. Apart from that keep the files identical
63
(3) sign in t/test-datlf-sigold/ with an old version of Module::Signature
65
(4) copy the signature over to t/test-datcrlf-sigold/
67
(5) sign in t/test-datlf-signew/ with the upcoming version of
70
(6) copy the signature over to t/test-datcrlf-signew/
78
use lib "$FindBin::Bin/../lib";
84
use File::Basename qw(dirname);
85
use File::Path qw(mkpath);
95
$Opt{f} ||= "t/wrapped-tests.bin";
97
sub _f ($) {File::Spec->catfile(split /\//, shift);}
99
my @files = qw(t/test-datcrlf-signew/MANIFEST
100
t/test-datcrlf-signew/README
101
t/test-datcrlf-signew/42.gz
102
t/test-datcrlf-signew/SIGNATURE
103
t/test-datcrlf-sigold/MANIFEST
104
t/test-datcrlf-sigold/README
105
t/test-datcrlf-sigold/42.gz
106
t/test-datcrlf-sigold/SIGNATURE
107
t/test-datlf-signew/MANIFEST
108
t/test-datlf-signew/README
109
t/test-datlf-signew/42.gz
110
t/test-datlf-signew/SIGNATURE
111
t/test-datlf-sigold/MANIFEST
112
t/test-datlf-sigold/README
113
t/test-datlf-sigold/42.gz
114
t/test-datlf-sigold/SIGNATURE
116
my @paths = map { _f($_) } @files;
120
for my $i (0..$#files) {
121
open my $fh, "<", $paths[$i] or die "Could not open '$paths[$i]': $!";
124
$VAR->{$files[$i]} = <$fh>;
126
my $d = Data::Dumper->new([$VAR]);
127
$d->Useqq(1)->Sortkeys(1);
128
open my $fh, ">", _f($Opt{f}) or die "Could not open $Opt{f}: $!";
132
open my $fh, "<", _f($Opt{f}) or die "Could not open $Opt{f}: $!";
138
for my $i (0..$#files) {
139
mkpath dirname $paths[$i];
140
open my $fh, ">", $paths[$i] or die "Could not open '$paths[$i]': $!";
143
print $fh $VAR1->{$files[$i]};
144
close $fh or die "Could not write $paths[$i]: $!";
147
warn "Either of the options -x or -c must be specified";
153
# cperl-indent-level: 4