[carton] 284/472: simplified test output check

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit 050090640d9afeaa30613d5147d04a701b860158
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Wed Jun 5 15:14:14 2013 +0900

    simplified test output check
---
 xt/CLI.pm            | 16 ++++------------
 xt/cli/check.t       |  8 ++++----
 xt/cli/deployment.t  |  6 +++---
 xt/cli/exec.t        | 12 ++++++------
 xt/cli/freeze.t      |  4 ++--
 xt/cli/help.t        | 12 ++++++------
 xt/cli/json_pp.t     |  2 +-
 xt/cli/mirror.t      |  4 ++--
 xt/cli/no_cpanfile.t |  2 +-
 xt/cli/perl.t        |  4 ++--
 xt/cli/test_deps.t   |  2 +-
 xt/cli/tree.t        |  4 ++--
 xt/cli/version.t     |  2 +-
 13 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/xt/CLI.pm b/xt/CLI.pm
index 70ce360..bb8f8a5 100644
--- a/xt/CLI.pm
+++ b/xt/CLI.pm
@@ -21,28 +21,20 @@ extends 'Carton::CLI';
 $Carton::CLI::UseSystem = 1;
 
 has dir => (is => 'rw');
-has output => (is => 'rw');
-has system_output => (is => 'rw');
-has system_error  => (is => 'rw');
-
-sub print {
-    my $self = shift;
-    $self->{output} .= $_[0];
-}
+has stdout => (is => 'rw');
+has stderr => (is => 'rw');
 
 sub run {
     my($self, @args) = @_;
 
     my $pushd = File::pushd::pushd $self->dir;
 
-    $self->{output} = '';
-
     my @capture = capture {
         eval { $self->SUPER::run(@args) };
     };
 
-    $self->system_output($capture[0]);
-    $self->system_error($capture[1]);
+    $self->stdout($capture[0]);
+    $self->stderr($capture[1]);
 }
 
 sub clean_local {
diff --git a/xt/cli/check.t b/xt/cli/check.t
index e3601e7..b1090b9 100644
--- a/xt/cli/check.t
+++ b/xt/cli/check.t
@@ -12,16 +12,16 @@ requires 'Try::Tiny';
 EOF
 
     $app->run("check");
-    like $app->output, qr/Following dependencies are not satisfied.*Try::Tiny/s;
-    unlike $app->output, qr/found in local but/;
+    like $app->stdout, qr/Following dependencies are not satisfied.*Try::Tiny/s;
+    unlike $app->stdout, qr/found in local but/;
 
     $app->run("install");
 
     $app->run("check");
-    like $app->output, qr/matches/;
+    like $app->stdout, qr/matches/;
 
     $app->run("list");
-    like $app->output, qr/Try-Tiny-/;
+    like $app->stdout, qr/Try-Tiny-/;
 }
 
 
diff --git a/xt/cli/deployment.t b/xt/cli/deployment.t
index c047d6e..a0dc66e 100644
--- a/xt/cli/deployment.t
+++ b/xt/cli/deployment.t
@@ -9,17 +9,17 @@ requires 'Try::Tiny', '== 0.11';
 EOF
 
     $app->run("install", "--deployment");
-    like $app->output, qr/deployment requires carton\.lock/;
+    like $app->stderr, qr/deployment requires carton\.lock/;
 
     $app->run("install");
     $app->clean_local;
 
     $app->run("install", "--deployment");
     $app->run("list");
-    like $app->output, qr/Try-Tiny-0\.11/;
+    like $app->stdout, qr/Try-Tiny-0\.11/;
 
     $app->run("exec", "perl", "-e", "use Try::Tiny 2;");
-    like $app->system_error, qr/Try::Tiny.* version 0\.11/;
+    like $app->stderr, qr/Try::Tiny.* version 0\.11/;
 }
 
 done_testing;
diff --git a/xt/cli/exec.t b/xt/cli/exec.t
index bbb0e8a..6ba7a45 100644
--- a/xt/cli/exec.t
+++ b/xt/cli/exec.t
@@ -5,7 +5,7 @@ use xt::CLI;
 {
     my $app = cli();
     $app->run("exec", "perl", "-e", 1);
-    like $app->output, qr/carton\.lock/;
+    like $app->stderr, qr/carton\.lock/;
 }
 
 {
@@ -16,7 +16,7 @@ use xt::CLI;
  TODO: {
         local $TODO = "exec now does not strip site_perl";
         $app->run("exec", "perl", "-e", "use Try::Tiny");
-        like $app->system_error, qr/Can't locate Try\/Tiny.pm/;
+        like $app->stderr, qr/Can't locate Try\/Tiny.pm/;
     }
 
     $app->dir->touch("cpanfile", <<EOF);
@@ -26,13 +26,13 @@ EOF
     $app->run("install");
 
     $app->run("exec", "--", "perl", "-e", 'use Try::Tiny; print $Try::Tiny::VERSION, "\n"');
-    like $app->system_output, qr/0\.11/;
+    like $app->stdout, qr/0\.11/;
 
     $app->run("exec", "perl", "-e", 'use Try::Tiny; print $Try::Tiny::VERSION, "\n"');
-    like $app->system_output, qr/0\.11/, "No need for -- as well";
+    like $app->stdout, qr/0\.11/, "No need for -- as well";
 
     $app->run("exec", "perl", "-MTry::Tiny", "-e", 'print $Try::Tiny::VERSION, "\n"');
-    like $app->system_output, qr/0\.11/;
+    like $app->stdout, qr/0\.11/;
 
     $app->dir->touch("cpanfile", <<EOF);
 requires 'Try::Tiny';
@@ -42,7 +42,7 @@ EOF
     $app->run("install");
     $app->run("exec", "--", "mojo", "version");
 
-    like $app->system_output, qr/Mojolicious \(4\.01/;
+    like $app->stdout, qr/Mojolicious \(4\.01/;
 }
 
 done_testing;
diff --git a/xt/cli/freeze.t b/xt/cli/freeze.t
index d9d701b..1d3c8a3 100644
--- a/xt/cli/freeze.t
+++ b/xt/cli/freeze.t
@@ -11,13 +11,13 @@ EOF
 
     $app->run("install");
     $app->run("list");
-    like $app->output, qr/Try-Tiny-0\.11/;
+    like $app->stdout, qr/Try-Tiny-0\.11/;
 
     $app->clean_local;
 
     $app->run("install");
     $app->run("list");
-    like $app->output, qr/Try-Tiny-0\.11/;
+    like $app->stdout, qr/Try-Tiny-0\.11/;
 }
 
 done_testing;
diff --git a/xt/cli/help.t b/xt/cli/help.t
index f2e1293..0ad0896 100644
--- a/xt/cli/help.t
+++ b/xt/cli/help.t
@@ -5,20 +5,20 @@ use xt::CLI;
 {
     my $app = cli();
     $app->run("help");
-    like $app->system_output, qr/Carton - Perl module/;
+    like $app->stdout, qr/Carton - Perl module/;
 
     $app->run("-h");
-    like $app->system_output, qr/Carton - Perl module/;
+    like $app->stdout, qr/Carton - Perl module/;
 
     $app->run("help", "install");
-    like $app->system_output, qr/Install the dependencies/;
+    like $app->stdout, qr/Install the dependencies/;
 
     $app->run("install", "-h");
-    like $app->system_output, qr/Install the dependencies/;
+    like $app->stdout, qr/Install the dependencies/;
 
     $app->run("help", "foobarbaz");
-    is $app->system_output, '';
-    like $app->system_error, qr/No documentation found/;
+    is $app->stdout, '';
+    like $app->stderr, qr/No documentation found/;
 }
 
 done_testing;
diff --git a/xt/cli/json_pp.t b/xt/cli/json_pp.t
index b704986..97798d3 100644
--- a/xt/cli/json_pp.t
+++ b/xt/cli/json_pp.t
@@ -18,7 +18,7 @@ EOF
     TODO: {
         local $TODO = "collect installs";
         $app->run("install", "--deployment");
-        unlike $app->system_error, qr/JSON::PP is not in range/;
+        unlike $app->stderr, qr/JSON::PP is not in range/;
     }
 }
 
diff --git a/xt/cli/mirror.t b/xt/cli/mirror.t
index 55921d5..128b6b3 100644
--- a/xt/cli/mirror.t
+++ b/xt/cli/mirror.t
@@ -16,7 +16,7 @@ EOF
     $app->run("install");
 
     $app->run("list");
-    is $app->output, "Hash-MultiValue-0.08\n";
+    is $app->stdout, "Hash-MultiValue-0.08\n";
 }
 
 {
@@ -30,7 +30,7 @@ EOF
     $app->run("install");
 
     $app->run("list");
-    like $app->output, qr/^PSGI-/;
+    like $app->stdout, qr/^PSGI-/;
 }
 
 done_testing;
diff --git a/xt/cli/no_cpanfile.t b/xt/cli/no_cpanfile.t
index 0f6ff82..5c47f15 100644
--- a/xt/cli/no_cpanfile.t
+++ b/xt/cli/no_cpanfile.t
@@ -5,7 +5,7 @@ use xt::CLI;
 {
     my $app = cli();
     $app->run("install");
-    like $app->output, qr/Can't locate cpanfile/;
+    like $app->stderr, qr/Can't locate cpanfile/;
 }
 
 done_testing;
diff --git a/xt/cli/perl.t b/xt/cli/perl.t
index ddd9477..dbfb5fd 100644
--- a/xt/cli/perl.t
+++ b/xt/cli/perl.t
@@ -14,10 +14,10 @@ requires 'Hash::MultiValue';
 EOF
 
     $app->run("install");
-    like $app->output, qr/Complete/;
+    like $app->stdout, qr/Complete/;
 
     $app->run("list");
-    like $app->output, qr/Hash-MultiValue-/;
+    like $app->stdout, qr/Hash-MultiValue-/;
 }
 
 done_testing;
diff --git a/xt/cli/test_deps.t b/xt/cli/test_deps.t
index 8f34ac6..f8b602e 100644
--- a/xt/cli/test_deps.t
+++ b/xt/cli/test_deps.t
@@ -17,7 +17,7 @@ EOF
     $app->run("install");
 
     $app->run("list");
-    like $app->output, qr/Test-NoWarnings/;
+    like $app->stdout, qr/Test-NoWarnings/;
 }
 
 done_testing;
diff --git a/xt/cli/tree.t b/xt/cli/tree.t
index 4e8e119..1f8777a 100644
--- a/xt/cli/tree.t
+++ b/xt/cli/tree.t
@@ -13,8 +13,8 @@ EOF
     $app->run("install");
     $app->run("tree");
 
-    like $app->output, qr/^HTML::Parser \(HTML-Parser-/m;
-    like $app->output, qr/^ HTML::Tagset \(HTML-Tagset-/m;
+    like $app->stdout, qr/^HTML::Parser \(HTML-Parser-/m;
+    like $app->stdout, qr/^ HTML::Tagset \(HTML-Tagset-/m;
 }
 
 done_testing;
diff --git a/xt/cli/version.t b/xt/cli/version.t
index 781b1e9..d99b9d6 100644
--- a/xt/cli/version.t
+++ b/xt/cli/version.t
@@ -6,7 +6,7 @@ use xt::CLI;
 my $app = cli();
 $app->run("version");
 
-like $app->output, qr/carton $Carton::VERSION/;
+like $app->stdout, qr/carton $Carton::VERSION/;
 
 done_testing;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git



More information about the Pkg-perl-cvs-commits mailing list