[svn:parrot] r39942 - in branches/darwinhints: . t/steps/init/hints

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Wed Jul 8 01:33:10 UTC 2009


Author: jkeenan
Date: Wed Jul  8 01:33:10 2009
New Revision: 39942
URL: https://trac.parrot.org/parrot/changeset/39942

Log:
Add a file to hold tests for the Darwin hints file.

Added:
   branches/darwinhints/t/steps/init/hints/darwin-01.t
      - copied, changed from r39938, branches/darwinhints/t/steps/init/hints-01.t
Modified:
   branches/darwinhints/MANIFEST

Modified: branches/darwinhints/MANIFEST
==============================================================================
--- branches/darwinhints/MANIFEST	Wed Jul  8 01:28:23 2009	(r39941)
+++ branches/darwinhints/MANIFEST	Wed Jul  8 01:33:10 2009	(r39942)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Jul  7 10:35:02 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Jul  8 01:32:16 2009 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -1995,6 +1995,7 @@
 t/steps/init/defaults-01.t                                  [test]
 t/steps/init/headers-01.t                                   [test]
 t/steps/init/hints-01.t                                     [test]
+t/steps/init/hints/darwin-01.t                              [test]
 t/steps/init/install-01.t                                   [test]
 t/steps/init/manifest-01.t                                  [test]
 t/steps/init/optimize-01.t                                  [test]

Copied and modified: branches/darwinhints/t/steps/init/hints/darwin-01.t (from r39938, branches/darwinhints/t/steps/init/hints-01.t)
==============================================================================
--- branches/darwinhints/t/steps/init/hints-01.t	Tue Jul  7 22:48:26 2009	(r39938, copy source)
+++ branches/darwinhints/t/steps/init/hints/darwin-01.t	Wed Jul  8 01:33:10 2009	(r39942)
@@ -1,171 +1,13 @@
 #! perl
-# Copyright (C) 2007, Parrot Foundation.
+# Copyright (C) 2009, Parrot Foundation.
 # $Id$
-# init/hints-01.t
+# init/hints/darwin-01.t
 
 use strict;
 use warnings;
-use Test::More tests => 26;
-use Carp;
-use Cwd;
-use File::Path ();
-use File::Spec::Functions qw/catfile/;
-use File::Temp qw(tempdir);
-use lib qw( lib t/configure/testlib );
-use_ok('config::init::defaults');
-use_ok('config::init::hints');
-use Parrot::Configure;
-use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Test qw(
-    test_step_thru_runstep
-    test_step_constructor_and_description
-);
-use IO::CaptureOutput qw | capture |;
-
-########## --verbose ##########
-
-my ($args, $step_list_ref) = process_options(
-    {
-        argv => [q{--verbose}],
-        mode => q{configure},
-    }
-);
-
-my $conf = Parrot::Configure->new;
-
-test_step_thru_runstep( $conf, q{init::defaults}, $args );
-
-my $pkg = q{init::hints};
-
-$conf->add_steps($pkg);
-
-my $serialized = $conf->pcfreeze();
-
-$conf->options->set( %{$args} );
-my $step = test_step_constructor_and_description($conf);
-
-# need to capture the --verbose output, because the fact that it does not end
-# in a newline confuses Test::Harness
-{
-    my $rv;
-    my $stdout;
-    capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
-    ok( $stdout, "verbose output:  hints were captured" );
-    ok( defined $rv, "runstep() returned defined value" );
-}
-
-$conf->replenish($serialized);
-
-########## --verbose; local hints directory ##########
-
-($args, $step_list_ref) = process_options(
-    {
-        argv => [q{--verbose}],
-        mode => q{configure},
-    }
-);
-
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-
-my $cwd = cwd();
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    File::Path::mkpath(qq{$tdir/init/hints})
-        or croak "Unable to create directory for local hints";
-    my $localhints = qq{$tdir/init/hints/local.pm};
-    open my $FH, '>', $localhints
-        or croak "Unable to open temp file for writing";
-    print $FH <<END;
-package init::hints::local;
-use strict;
-sub runstep {
-    return 1;
-}
-1;
-END
-    close $FH or croak "Unable to close temp file after writing";
-    unshift( @INC, $tdir );
-
-    {
-     my $rv;
-     my $stdout;
-     capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
-     ok( $stdout, "verbose output:  hints were captured" );
-     ok( defined $rv, "runstep() returned defined value" );
-    }
-    unlink $localhints or croak "Unable to delete $localhints";
-}
-
-$conf->replenish($serialized);
-
-########## --verbose; local hints directory; no runstep() in local hints ##########
-
-($args, $step_list_ref) = process_options(
-    {
-        argv => [q{--verbose}],
-        mode => q{configure},
-    }
-);
-
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-
-$cwd = cwd();
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    File::Path::mkpath(qq{$tdir/init/hints})
-        or croak "Unable to create directory for local hints";
-    my $localhints = qq{$tdir/init/hints/local.pm};
-    open my $FH, '>', $localhints
-        or croak "Unable to open temp file for writing";
-    print $FH <<END;
-package init::hints::local;
-use strict;
-1;
-END
-    close $FH or croak "Unable to close temp file after writing";
-    unshift( @INC, $tdir );
-
-    {
-     my $rv;
-     my $stdout;
-     capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
-     ok( $stdout, "verbose output:  hints were captured" );
-     ok( defined $rv, "runstep() returned defined value" );
-    }
-    unlink $localhints or croak "Unable to delete $localhints";
-}
-
-$conf->replenish($serialized);
-
-########## --verbose; imaginary OS ##########
-
-($args, $step_list_ref) = process_options(
-    {
-        argv => [ q{--verbose} ],
-        mode => q{configure},
-    }
-);
-
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-{
-    my ($stdout, $stderr, $ret);
-    $conf->data->set_p5( OSNAME => q{imaginaryOS} );
-    my $osname = lc( $conf->data->get_p5( 'OSNAME' ) );
-    my $hints_file = catfile('config', 'init', 'hints', "$osname.pm");
-    capture (
-        sub { $ret = $step->runstep($conf); },
-        \$stdout,
-        \$stderr,
-    );;
-    like(
-        $stdout,
-        qr/No \Q$hints_file\E found/s,
-        "Got expected verbose output when no hints file found"
-    );
-}
+use Test::More; # tests => 26;
+plan( skip_all => 'only needs testing on Darwin' ) unless $^O =~ /darwin/i;
+plan( tests =>  1 );
 
 pass("Completed all tests in $0");
 
@@ -173,17 +15,17 @@
 
 =head1 NAME
 
-init/hints-01.t - test init::hints
+init/hints/darwin-01.t - test init::hints::darwin
 
 =head1 SYNOPSIS
 
-    % prove t/steps/init/hints-01.t
+    % prove t/steps/init/hints/darwin-01.t
 
 =head1 DESCRIPTION
 
 The files in this directory test functionality used by F<Configure.pl>.
 
-The tests in this file test init::hints.
+The tests in this file test init::hints::darwin.
 
 =head1 AUTHOR
 
@@ -191,7 +33,7 @@
 
 =head1 SEE ALSO
 
-config::init::hints, F<Configure.pl>.
+config::init::hints::darwin, F<Configure.pl>.
 
 =cut
 


More information about the parrot-commits mailing list