[Bps-public-commit] test-expect branch, master, updated. 0.33
Alex Vandiver
alexmv at bestpractical.com
Thu Apr 2 23:17:18 EDT 2015
The branch, master has been updated
via ae73a6677ee1d9213e98c1845ff225da7ad16fe4 (commit)
via c90c00a6c0d3cf9f9840d9948cabe12493afd457 (commit)
via 5204bdb04c6adeebaf75ff8aa9d675fa4cf7ec89 (commit)
via 7c0474b2ce6e5f156f5cf540191fb95d728ef4af (commit)
via 146eeec3861b7c9a55df794c835dac2ed1a95d17 (commit)
from 03b28d1b1a03d09b046613830e04f8cddf0773ac (commit)
Summary of changes:
Build.PL | 4 +++-
CHANGES | 5 +++++
META.json | 10 +++++++---
META.yml | 12 ++++++------
Makefile.PL | 5 +----
lib/Test/Expect.pm | 21 ++++++++++++---------
read | 3 ++-
readline | 3 ++-
t/simple.t | 6 +++---
9 files changed, 41 insertions(+), 28 deletions(-)
- Log -----------------------------------------------------------------
commit 146eeec3861b7c9a55df794c835dac2ed1a95d17
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Apr 2 22:28:40 2015 -0400
Move multiple dependencies to test-only
diff --git a/Build.PL b/Build.PL
index 55c2e7f..cf0508f 100644
--- a/Build.PL
+++ b/Build.PL
@@ -8,9 +8,11 @@ my $build = Module::Build->new(
requires => {
'Class::Accessor::Chained::Fast' => '0',
'Expect::Simple' => '0',
- 'Term::ReadLine' => '0',
+ },
+ test_requires => {
'Test::Builder' => '0',
'Test::More' => '0',
+ 'Term::ReadLine' => '0',
},
);
$build->create_build_script;
diff --git a/META.json b/META.json
index 678334c..f9626a7 100644
--- a/META.json
+++ b/META.json
@@ -23,7 +23,11 @@
"runtime" : {
"requires" : {
"Class::Accessor::Chained::Fast" : "0",
- "Expect::Simple" : "0",
+ "Expect::Simple" : "0"
+ }
+ },
+ "test" : {
+ "requires" : {
"Term::ReadLine" : "0",
"Test::Builder" : "0",
"Test::More" : "0"
diff --git a/META.yml b/META.yml
index ba098e2..0d34479 100644
--- a/META.yml
+++ b/META.yml
@@ -3,7 +3,10 @@ abstract: 'Automated driving and testing of terminal-based programs'
author:
- 'Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>'
- 'Original module by Leon Brocard, E<lt>acme at astray.comE<gt>'
-build_requires: {}
+build_requires:
+ Term::ReadLine: '0'
+ Test::Builder: '0'
+ Test::More: '0'
configure_requires:
Module::Build: '0.42'
dynamic_config: 1
@@ -20,9 +23,6 @@ provides:
requires:
Class::Accessor::Chained::Fast: '0'
Expect::Simple: '0'
- Term::ReadLine: '0'
- Test::Builder: '0'
- Test::More: '0'
resources:
license: http://dev.perl.org/licenses/
version: '0.32'
diff --git a/Makefile.PL b/Makefile.PL
index 8b8e45b..3b42019 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,10 +6,7 @@ WriteMakefile
'VERSION_FROM' => 'lib/Test/Expect.pm',
'PREREQ_PM' => {
'Class::Accessor::Chained::Fast' => '0',
- 'Expect::Simple' => '0',
- 'Term::ReadLine' => '0',
- 'Test::Builder' => '0',
- 'Test::More' => '0'
+ 'Expect::Simple' => '0'
},
'INSTALLDIRS' => 'site',
'EXE_FILES' => [],
commit 7c0474b2ce6e5f156f5cf540191fb95d728ef4af
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Apr 2 22:58:46 2015 -0400
Switch to an explicit %ENV setting
This allows for the multi-argument version, which bypasses the shell, by
passing an arrayref in $conf{command}.
diff --git a/lib/Test/Expect.pm b/lib/Test/Expect.pm
index a3ac46b..4445fd3 100644
--- a/lib/Test/Expect.pm
+++ b/lib/Test/Expect.pm
@@ -38,8 +38,9 @@ sub import {
sub expect_run {
my (%conf) = @_;
+ local $ENV{PERL_RL} = " o=0";
$expect = Expect::Simple->new(
- { Cmd => "PERL_RL=\" o=0\" " . $conf{command},
+ { Cmd => $conf{command},
Prompt => $conf{prompt},
DisconnectCmd => $conf{quit},
Verbose => 0,
@@ -107,7 +108,7 @@ Test::Expect - Automated driving and testing of terminal-based programs
use Test::Expect;
use Test::More tests => 13;
expect_run(
- command => "perl testme.pl",
+ command => ["perl", "testme.pl"],
prompt => 'testme: ',
quit => 'quit',
);
@@ -135,11 +136,14 @@ the interactive program to run, what the prompt of the program is, and
which command quits the program:
expect_run(
- command => "perl testme.pl",
+ command => ["perl", "testme.pl"],
prompt => 'testme: ',
quit => 'quit',
);
+The C<command> may either be a string, or an arrayref of program and
+arguments; the latter for bypasses the shell.
+
=head2 expect
The expect subroutine is the catch all subroutine. You pass in the
diff --git a/read b/read
index 6855fb2..56252cc 100644
--- a/read
+++ b/read
@@ -3,7 +3,8 @@ use strict;
use warnings;
$| = 1;
-print "* Hi there, to read\n";
+my $what = $ARGV[0] || "there";
+print "* Hi $what, to read\n";
while (1) {
print "read: ";
diff --git a/readline b/readline
index 68e33e5..df5665c 100644
--- a/readline
+++ b/readline
@@ -3,7 +3,8 @@ use strict;
use warnings;
use Term::ReadLine;
-print "* Hi there, to readline\n";
+my $what = $ARGV[0] || "there";
+print "* Hi $what, to readline\n";
my $term = Term::ReadLine->new('readline');
diff --git a/t/simple.t b/t/simple.t
index f5e8b5a..841dda4 100644
--- a/t/simple.t
+++ b/t/simple.t
@@ -12,13 +12,13 @@ ok(1, "True");
foreach my $filename ('read', 'readline') {
ok($filename, "Testing $filename");
expect_run(
- command => "$^X $filename",
+ command => [$^X, $filename, "world"],
prompt => $filename . ': ',
quit => 'quit',
);
isa_ok(expect_handle(), 'Expect');
- expect_like(qr/Hi there, to $filename/, "expect_like");
- expect_is("* Hi there, to $filename", "expect_is");
+ expect_like(qr/Hi world, to $filename/, "expect_like");
+ expect_is("* Hi world, to $filename", "expect_is");
expect_send("ping", "expect_send");
expect("ping", "pong", "expect");
};
commit 5204bdb04c6adeebaf75ff8aa9d675fa4cf7ec89
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Apr 2 23:02:41 2015 -0400
Force use of the stuf readline implementation
Term::ReadLine is an umbrella module which chooses which underlying
implementation to use based on what is installed. Unfortunately, they
are not all alike; Term::ReadLine::Perl, for instance, inserts an extra
blank line (filled to the terminal width with spaces) before the prompt.
This causes t/simple.t to fail.
This would usually be addressed by switching to a regular expression to
sop up the extra spaces. However, the entire point of the failing test
in t/simple.t is to test `expect_is`; `expect_like` is tested
separately. Thus, the test _demands_ a reliable output from
Term::ReadLine.
Moreover, the Test::Expect test is not the only one that would expect
that output be reliable from deployment-to-deployment; tests which use
Test::Expect will likely similarly expect consistency in the programs
they test.
To this end, enforce (using the PERL_RL environment variable) the "Stub"
implementation of Term::Readline upon programs called by Test::Expect.
The stub is guaranteed to be installed if Term::ReadLine is, offers all
of the functionality that Test::Expect needs (the ability to read
lines), and produces consistent, reliable output.
diff --git a/lib/Test/Expect.pm b/lib/Test/Expect.pm
index 4445fd3..bfadc2e 100644
--- a/lib/Test/Expect.pm
+++ b/lib/Test/Expect.pm
@@ -38,7 +38,7 @@ sub import {
sub expect_run {
my (%conf) = @_;
- local $ENV{PERL_RL} = " o=0";
+ local $ENV{PERL_RL} = "Stub o=0";
$expect = Expect::Simple->new(
{ Cmd => $conf{command},
Prompt => $conf{prompt},
commit c90c00a6c0d3cf9f9840d9948cabe12493afd457
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Apr 2 23:12:37 2015 -0400
Fix the links in the HTML "BUGS" section
diff --git a/lib/Test/Expect.pm b/lib/Test/Expect.pm
index bfadc2e..1bb69f9 100644
--- a/lib/Test/Expect.pm
+++ b/lib/Test/Expect.pm
@@ -193,11 +193,10 @@ Original module by Leon Brocard, E<lt>acme at astray.comE<gt>
=head1 BUGS
-=for html
-<p>All bugs should be reported via email to
-L<bug-RT-Extension-SLA at rt.cpan.org|mailto:bug-RT-Extension-SLA at rt.cpan.org>
-or via the web at
-L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-SLA>.</p>
+=for html <p>All bugs should be reported via email to <a
+href="mailto:bug-RT-Extension-SLA at rt.cpan.org">bug-RT-Extension-SLA at rt.cpan.org</a>
+or via the web at <a
+href="http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-SLA">rt.cpan.org</a>.</p>
=for text
All bugs should be reported via email to
commit ae73a6677ee1d9213e98c1845ff225da7ad16fe4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Apr 2 23:09:55 2015 -0400
Version 0.33 releng
diff --git a/CHANGES b/CHANGES
index a8ad85d..88552e6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
Revision history for Perl module Test::Expect
+0.33 2015-04-02
+ - Allow multi-argument forms of "command" to be passed
+ - Force Term::ReadLine in called programs to use the "Stub"
+ implementation, which has consistent output (vs Term::ReadLine::Perl)
+
0.32 2015-04-02
- Quote regex meta-characters before using them in a regex (fixes
#81987)
diff --git a/META.json b/META.json
index f9626a7..3112c1c 100644
--- a/META.json
+++ b/META.json
@@ -37,7 +37,7 @@
"provides" : {
"Test::Expect" : {
"file" : "lib/Test/Expect.pm",
- "version" : "0.32"
+ "version" : "0.33"
}
},
"release_status" : "stable",
@@ -46,5 +46,5 @@
"http://dev.perl.org/licenses/"
]
},
- "version" : "0.32"
+ "version" : "0.33"
}
diff --git a/META.yml b/META.yml
index 0d34479..fc1526e 100644
--- a/META.yml
+++ b/META.yml
@@ -19,10 +19,10 @@ name: Test-Expect
provides:
Test::Expect:
file: lib/Test/Expect.pm
- version: '0.32'
+ version: '0.33'
requires:
Class::Accessor::Chained::Fast: '0'
Expect::Simple: '0'
resources:
license: http://dev.perl.org/licenses/
-version: '0.32'
+version: '0.33'
diff --git a/lib/Test/Expect.pm b/lib/Test/Expect.pm
index 1bb69f9..db6b611 100644
--- a/lib/Test/Expect.pm
+++ b/lib/Test/Expect.pm
@@ -7,7 +7,7 @@ use Exporter;
use Test::Builder;
use base qw(Class::Accessor::Chained::Fast Exporter);
__PACKAGE__->mk_accessors(qw(program));
-our $VERSION = "0.32";
+our $VERSION = "0.33";
our @EXPORT = qw(
expect_run
expect_handle
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list