[Jifty-commit] r984 - in jifty/trunk: t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu May 4 00:10:31 EDT 2006


Author: ewilhelm
Date: Thu May  4 00:10:28 2006
New Revision: 984

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/t/01-version_checks.t

Log:
 r918 at mjolnir:  ewilhelm | 2006-05-03 20:52:39 -0700
 t/01-version_checks.t - actually fails, tests everything


Modified: jifty/trunk/t/01-version_checks.t
==============================================================================
--- jifty/trunk/t/01-version_checks.t	(original)
+++ jifty/trunk/t/01-version_checks.t	Thu May  4 00:10:28 2006
@@ -1,9 +1,32 @@
 #!/usr/bin/perl -w
 use strict;
-use Test::More tests => 2;
+use Test::More qw(no_plan);
 
-# TODO: check everything like this?
 use ExtUtils::MakeMaker;
-use_ok('Jifty::JSON');
-ok(MM->parse_version($INC{'Jifty/JSON.pm'}));
+use_ok('Jifty::Everything');
+my @files = grep({$_ !~ m#^/#} map({$INC{$_}} grep(/^Jifty\//, keys(%INC))));
+ok(scalar(@files));
 
+foreach my $file (@files) {
+	# Gah! parse_version complains on stderr!
+	my ($e, @a) = error_catch(sub {MM->parse_version($file)});
+	ok(($e || '') eq '', $file) or warn "$e ";
+}
+
+# runs subroutine reference, looking for error message $look in STDERR
+# and runs tests based on $name
+#   ($errs, @ans) = error_catch(sub {$this->test()});
+#
+sub error_catch {
+	my ($sub) = @_;
+	my $TO_ERR;
+	open($TO_ERR, '<&STDERR');
+	close(STDERR);
+	my $catch;
+	open(STDERR, '>', \$catch);
+	my @ans = $sub->();
+	open(STDERR, ">&", $TO_ERR);
+	close($TO_ERR);
+	return($catch, @ans);
+} # end subroutine error_catch definition
+########################################################################


More information about the Jifty-commit mailing list