File: Fix_Standard_Tests.pm

package info (click to toggle)
grepmail 5.3111-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,420 kB
  • sloc: perl: 8,724; makefile: 6
file content (44 lines) | stat: -rw-r--r-- 1,088 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
32
33
34
35
36
37
38
39
40
41
42
43
44
package Module::Install::PRIVATE::Fix_Standard_Tests;

use strict;
use warnings;

use vars qw( @ISA $VERSION );

use Module::Install::Base;
@ISA = qw( Module::Install::Base );

$VERSION = sprintf "%d.%02d%02d", q/0.1.0/ =~ /(\d+)/g;

# ---------------------------------------------------------------------------

sub fix_standard_tests {
  my ($self, $script_name, @args) = @_;

  $self->perl_version('5.005');

  $self->include_deps('File::Slurper', 0);

  require File::Slurper;
  File::Slurper->import('read_text', 'write_text');

  # Update compile test
  {
    my $test = read_text('t/000_standard__compile.t', undef, 1);

    $test =~ s#all_pm_files_ok\(\)#all_pl_files_ok('blib/script/$script_name')# or die "Couldn't update compile test";

    write_text('t/000_standard__compile.t', $test, undef, 1);
  }

  # Update critic test
  {
    my $test = read_text('t/000_standard__perl_critic.t', undef, 1);

    $test =~ s#all_critic_ok\("lib"\)#all_critic_ok("blib")# or die "Couldn't update critic test";

    write_text('t/000_standard__perl_critic.t', $test, undef, 1);
  }
}

1;