Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for Porting/todo.pod task, refactor t/lib/commonsense.pl to use test.pl #12259

Closed
p5pRT opened this issue Jul 8, 2012 · 4 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Jul 8, 2012

Migrated from rt.perl.org#114044 (status was 'resolved')

Searchable as RT114044$

@p5pRT
Copy link
Author

p5pRT commented Jul 8, 2012

From @perlDreamer

0002-Refactor-t-lib-commonsense.t-to-use-t-test.pl-instea.patch
From 975a342d95504ee5ccc83706f1e742fb02271a9a Mon Sep 17 00:00:00 2001
From: Colin Kuskie <colink@perldreamer.com>
Date: Sun, 8 Jul 2012 15:42:03 -0700
Subject: [PATCH 2/2] Refactor t/lib/commonsense.t to use t/test.pl instead of
 making TAP by hand.  Add a BAIL_OUT method to test.pl
 for lib/commonsense.t to use.

---
 t/lib/commonsense.t |   25 +++++++++++++++----------
 t/test.pl           |    6 ++++++
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/t/lib/commonsense.t b/t/lib/commonsense.t
index 27fd302..9f0f13f 100644
--- a/t/lib/commonsense.t
+++ b/t/lib/commonsense.t
@@ -1,21 +1,26 @@
 #!./perl
 
-chdir 't' if -d 't';
-@INC = '../lib';
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+    require './test.pl';
+}
+
+plan( tests => 1);
+
 require Config; import Config;
+
 if (($Config{'extensions'} !~ /\bFcntl\b/) ){
-  print "Bail out! Perl configured without Fcntl module\n";
-  exit 0;
+  BAIL_OUT("Perl configured without Fcntl module");
 }
-if (($Config{'extensions'} !~ /\bIO\b/) ){
-  print "Bail out! Perl configured without IO module\n";
-  exit 0;
+##Finds IO submodules when using \b
+if (($Config{'extensions'} !~ /\bIO\s/) ){
+  BAIL_OUT("Perl configured without IO module");
 }
 # hey, DOS users do not need this kind of common sense ;-)
 if ($^O ne 'dos' && ($Config{'extensions'} !~ /\bFile\/Glob\b/) ){
-  print "Bail out! Perl configured without File::Glob module\n";
-  exit 0;
+  BAIL_OUT("Perl configured without File::Glob module");
 }
 
-print "1..1\nok 1\n";
+pass('common sense');
 
diff --git a/t/test.pl b/t/test.pl
index 9d1da29..6d45076 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -189,6 +189,12 @@ sub find_git_or_skip {
     skip($reason, @_);
 }
 
+sub BAIL_OUT {
+    my ($reason) = @_;
+    _print("Bail out!  $reason\n");
+    exit 255;
+}
+
 sub _ok {
     my ($pass, $where, $name, @mess) = @_;
     # Do not try to microoptimize by factoring out the "not ".
-- 
1.7.5.4

@p5pRT
Copy link
Author

p5pRT commented Jul 9, 2012

From @doy

Thanks, applied as 779248a.
-doy

@p5pRT
Copy link
Author

p5pRT commented Jul 9, 2012

From [Unknown Contact. See original ticket]

Thanks, applied as 779248a.
-doy

@p5pRT
Copy link
Author

p5pRT commented Jul 9, 2012

@doy - Status changed from 'new' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant