Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
174 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/perl | ||
use warnings; | ||
use strict; | ||
|
||
use Data::Dumper; | ||
use Devel::Examine::Subs; | ||
use File::Copy; | ||
use Test::More tests => 4; | ||
|
||
my $file = 't/sample.data'; | ||
my $copy = 't/add_func_engine.data'; | ||
|
||
my %params = ( | ||
file => $file, | ||
copy => $copy, | ||
post_proc => [ 'file_lines_contain' ], | ||
engine => testing(), | ||
); | ||
|
||
#<des> | ||
sub testing { | ||
|
||
return sub { | ||
|
||
my $p = shift; | ||
my $struct = shift; | ||
|
||
return $struct; | ||
}; | ||
} | ||
#</des> | ||
|
||
my $install = 1; # set this to true to install | ||
|
||
if ($install) { | ||
my $des = Devel::Examine::Subs->new(copy => $copy); | ||
my $ret = $des->add_functionality(add_functionality => 'engine'); | ||
is ($ret, 1, "add_functionality engine succeeded"); | ||
} | ||
else { | ||
my $des = Devel::Examine::Subs->new(%params); | ||
my $struct = $des->run(\%params); | ||
print Dumper $struct; | ||
} | ||
|
||
open my $fh, '<', $copy or die $!; | ||
my @file = <$fh>; | ||
close $fh; | ||
|
||
is ((grep { $_ =~ /testing =>/ } @file), 1, "dt updated ok"); | ||
is ((grep { $_ =~ /sub testing \{/ } @file), 1, "sub added ok"); | ||
|
||
eval { unlink $copy or die $!; }; | ||
is ($@, '', "temp file removed ok"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/perl | ||
use warnings; | ||
use strict; | ||
|
||
use Data::Dumper; | ||
use Devel::Examine::Subs; | ||
use File::Copy; | ||
use Test::More tests => 4; | ||
|
||
my $file = 't/sample.data'; | ||
my $copy = 't/add_func_preproc.data'; | ||
|
||
my %params = ( | ||
file => $file, | ||
copy => $copy, | ||
post_proc => [ 'file_lines_contain' ], | ||
engine => testing(), | ||
); | ||
|
||
#<des> | ||
sub testing { | ||
|
||
return sub { | ||
|
||
my $p = shift; | ||
my $struct = shift; | ||
|
||
return $struct; | ||
}; | ||
} | ||
#</des> | ||
|
||
my $install = 1; # set this to true to install | ||
|
||
if ($install) { | ||
my $des = Devel::Examine::Subs->new(copy => $copy); | ||
my $ret = $des->add_functionality(add_functionality => 'pre_proc'); | ||
is ($ret, 1, "add_functionality pre_proc succeeded"); | ||
} | ||
else { | ||
my $des = Devel::Examine::Subs->new(%params); | ||
my $struct = $des->run(\%params); | ||
print Dumper $struct; | ||
} | ||
|
||
open my $fh, '<', $copy or die $!; | ||
my @file = <$fh>; | ||
close $fh; | ||
|
||
is ((grep { $_ =~ /testing =>/ } @file), 1, "dt updated ok"); | ||
is ((grep { $_ =~ /sub testing \{/ } @file), 1, "sub added correctly"); | ||
|
||
eval { unlink $copy or die $!; }; | ||
is ($@, '', "temp file removed ok"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/perl | ||
use warnings; | ||
use strict; | ||
|
||
use Data::Dumper; | ||
use Devel::Examine::Subs; | ||
use File::Copy; | ||
use Test::More tests => 4; | ||
|
||
my $file = 't/sample.data'; | ||
my $copy = 't/add_func_postproc.data'; | ||
|
||
my %params = ( | ||
file => $file, | ||
copy => $copy, | ||
post_proc => [ 'file_lines_contain' ], | ||
engine => testing(), | ||
); | ||
|
||
#<des> | ||
sub testing { | ||
|
||
return sub { | ||
|
||
my $p = shift; | ||
my $struct = shift; | ||
|
||
return $struct; | ||
}; | ||
} | ||
#</des> | ||
|
||
my $install = 1; # set this to true to install | ||
|
||
if ($install) { | ||
my $des = Devel::Examine::Subs->new(copy => $copy); | ||
my $ret = $des->add_functionality(add_functionality => 'post_proc'); | ||
is ($ret, 1, "add_functionality post_proc succeeded"); | ||
} | ||
else { | ||
my $des = Devel::Examine::Subs->new(%params); | ||
my $struct = $des->run(\%params); | ||
print Dumper $struct; | ||
} | ||
|
||
open my $fh, '<', $copy or die $!; | ||
my @file = <$fh>; | ||
close $fh; | ||
|
||
is ((grep { $_ =~ /testing =>/ } @file), 1, "dt updated ok"); | ||
is ((grep { $_ =~ /sub testing \{/ } @file), 1, "sub added correctly"); | ||
|
||
eval { unlink $copy or die $!; }; | ||
is ($@, '', "temp file removed ok"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters