We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 807b08e commit 3296bfcCopy full SHA for 3296bfc
MANIFEST
@@ -9,9 +9,10 @@ pack.PL Script to make the packed version
9
README
10
README.md The tutorial
11
t/00-load.t
12
-t/01-basic.t
13
-t/01-readme.t
14
-t/02-cmdline.t
+t/01-capture.t
+t/02-basic.t
+t/02-readme.t
15
+t/03-cmdline.t
16
t/03-idempotency.t
17
t/04-include.t
18
t/05-external-command.t
@@ -21,5 +22,7 @@ t/a.txt
21
22
t/b.txt
23
t/c.txt
24
t/included.txt
25
+t/lib/PerlPPTest.pm The test kit
26
+t/lib/TestcaseList.pm Helper library for autonumbering testcases
27
t/multiline.txt
28
t/unclosed.txt
Makefile.PL
@@ -17,11 +17,10 @@ authortest:
\tRELEASE_TESTING=1 prove -l xt"
19
testhere: # Run the tests from lib rather than blib
20
-\texport PERLPP_CMD="\\\"$secure_perl_path\\\" -Ilib bin/perlpp"; \\
\tperl -Ilib -e 'use Test::Harness "runtests"; runtests \@ARGV;' -- t/*.t
testpacked: pack # Test the packed version
-\texport PERLPP_NOUSE=1 PERLPP_PERLOPTS="blib/perlpp"; \\
+\tPERLPP_NOUSE=1 PERLPP_PERLOPTS="blib/perlpp" \\
\tperl -e 'use Test::Harness "runtests"; runtests \@ARGV;' -- t/*.t
EOT
} #postamble
t/lib/PerlPPTest.pm
@@ -51,12 +51,17 @@ sub run_perlpp {
51
#say STDERR "## args:\n", (Dumper($lrArgs) =~ s/^/##/mgr);
52
53
if($ENV{PERLPP_PERLOPTS}) {
54
- #say STDERR "# running external perl";
55
- $retval = run3(
56
- join(' ', get_perl_filename(), $ENV{PERLPP_PERLOPTS},
57
- @$lrArgs),
58
- $refStdin, $refStdout, $refStderr);
+ #my $cmd = join(' ', get_perl_filename(), $ENV{PERLPP_PERLOPTS},
+ # @$lrArgs);
+ my $cmd = [get_perl_filename(), shellwords($ENV{PERLPP_PERLOPTS}),
+ @$lrArgs];
+ #say STDERR '# running external perl: {', join('|',@$cmd), '}';
59
+ $retval = run3($cmd, $refStdin, $refStdout, $refStderr);
60
+ #say STDERR "# returned $retval; status $?";
61
# TODO figure out $?, retval, &c.
62
+ # TODO tell the caller if the user hit Ctl-C on the inner perl
63
+ # invocation so the caller can abort if desired.
64
+ # That seems to be status 2, on my test system.
65
66
} else {
67
#say STDERR "# running perlpp internal";
t/lib/TestcaseList.pm
@@ -0,0 +1,48 @@
1
+#!perl
2
+# TestcaseList.pm: Automatically number a list, e.g., of testcases.
3
+# Copyright (c) 2018 Chris White.
4
+# Dual-licensed Artistic 2 or CC-BY 4.0 Intl.
5
+# Modified from https://stackoverflow.com/a/50516105/2877364 by
6
+# https://stackoverflow.com/users/2877364/cxw
7
+
8
+package TestcaseList;
+use 5.010001;
+use strict;
+use warnings;
+# Constructor
+sub new { # call as $class->new(__LINE__); each element is one line
+ my $class = shift;
+ my $self = bless {lnum => shift // 0, arr => []}, $class;
+ # Make a loader that adds an item and returns itself --- not $self
+ $self->{loader} = sub { $self->L(@_); return $self->{loader} };
+ # TODO add a skip() method callable on the loader
+ return $self;
+}
+# Accessors
+sub size { return scalar @{ shift->{arr} }; }
+sub last { return shift->size-1; } # $#
+sub arr { return shift->{arr}; }
29
30
+# Loading
31
+sub load { goto &{ shift->{loader} } } # kick off loading
32
33
+sub L { # Push a new record with the next line number on the front
34
+ my $self = shift;
35
+ push @{ $self->{arr} }, [++$self->{lnum}, @_];
36
37
+} #L
38
39
+sub add { # just add it
40
41
+ ++$self->{lnum}; # keep it consistent
42
+ push @{ $self->{arr} }, [@_];
43
44
+} #add
45
46
+1;
47
48
+# vi: set ts=4 sts=0 sw=4 noet ai: #
0 commit comments