[svn:parrot] r37901 - in branches/install_tools: . t/tools/install

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sat Apr 4 15:01:37 UTC 2009


Author: jkeenan
Date: Sat Apr  4 15:01:33 2009
New Revision: 37901
URL: https://trac.parrot.org/parrot/changeset/37901

Log:
Prepare to split current test file into two files:  one focusing on create_directories(), the other on install_files().

Added:
   branches/install_tools/t/tools/install/01-create_directories.t
      - copied unchanged from r37894, branches/install_tools/t/tools/install/01-install_files.t
   branches/install_tools/t/tools/install/02-install_files.t
      - copied unchanged from r37894, branches/install_tools/t/tools/install/01-install_files.t
Deleted:
   branches/install_tools/t/tools/install/01-install_files.t
Modified:
   branches/install_tools/MANIFEST

Modified: branches/install_tools/MANIFEST
==============================================================================
--- branches/install_tools/MANIFEST	Sat Apr  4 12:34:50 2009	(r37900)
+++ branches/install_tools/MANIFEST	Sat Apr  4 15:01:33 2009	(r37901)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Mar 11 23:28:58 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Apr  4 15:00:39 2009 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2495,7 +2495,8 @@
 t/tools/dev/searchops.t                                     [test]
 t/tools/dev/searchops/samples.pm                            [test]
 t/tools/dump_pbc.t                                          [test]
-t/tools/install/01-install_files.t                          [test]
+t/tools/install/01-create_directories.t                     [test]
+t/tools/install/02-install_files.t                          [test]
 t/tools/ops2cutils/01-new.t                                 [test]
 t/tools/ops2cutils/02-usage.t                               [test]
 t/tools/ops2cutils/03-print_c_header_file.t                 [test]

Copied: branches/install_tools/t/tools/install/01-create_directories.t (from r37894, branches/install_tools/t/tools/install/01-install_files.t)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/install_tools/t/tools/install/01-create_directories.t	Sat Apr  4 15:01:33 2009	(r37901, copy of r37894, branches/install_tools/t/tools/install/01-install_files.t)
@@ -0,0 +1,253 @@
+#! perl
+# Copyright (C) 2007, Parrot Foundation.
+# $Id$
+# 01-install_files.t
+
+use strict;
+use warnings;
+
+use Test::More qw(no_plan); # tests =>  8;
+use Carp;
+use File::Path qw( mkpath );
+use File::Temp qw( tempdir );
+use lib qw( lib );
+use Parrot::Install qw(
+    install_files
+    create_directories
+    lines_to_files
+);
+use IO::CaptureOutput qw( capture );
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+01-install_files.t - test subroutines exported by C<Parrot::Install>
+
+=head1 SYNOPSIS
+
+    % prove t/tools/install/01-install_files.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by
+F<tools/dev/install_files.pl> and F<tools/dev/install_dev_files.pl> and
+exported by F<lib/Parrot/Install.pm>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Install, F<tools/dev/install_files.pl>, F<tools/dev/install_dev_files.pl>
+
+=cut
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my $dirs_seen = 0;
+    foreach my $d (@dirs) {
+        $dirs_seen++ if -d "$tdir$d";
+    }
+    is($dirs_seen, 2, 'got expected number of directories created');
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    my @created = mkpath( "$tdir$dirs[0]" );
+    ok( ( -d $created[0] ),
+        "one directory created before create_directories() is called" );
+
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my $dirs_seen = 0;
+    foreach my $d (@dirs) {
+        $dirs_seen++ if -d "$tdir$d";
+    }
+    is($dirs_seen, 2,
+        "create_directories() handled case where one directory already existed" );
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    my @created = mkpath( $tdir . 'foo' );
+    ok( ( -d $created[0] ),
+        "one directory created before create_directories() is called" );
+
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my $dirs_seen = 0;
+    foreach my $d (@dirs) {
+        $dirs_seen++ if -d "$tdir$d";
+    }
+    is($dirs_seen, 2,
+        "create_directories() handled case where one path partially existed" );
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my($fullname);
+
+    my @files = ( ['README', "$dirs[0]/README"] );
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 1, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() completed successfully in dry-run case' );
+    
+        my $files_created = 0;
+        foreach my $el (@files) {
+            $files_created++ if -f "$tdir$el->[1]";
+        }
+        is( $files_created, 0, 'dry-run, so no files created' );
+
+        like( $stdout, qr/Installing.*README.*README/s,
+            'got expected installation message' );
+    }
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 0, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() completed successfully in production case' );
+    
+        my $files_created = 0;
+        foreach my $el (@files) {
+            $files_created++ if -f "$tdir$el->[1]";
+        }
+        is( $files_created, 1, 'production, so 1 file created' );
+
+        like( $stdout, qr/Installing.*README/s,
+            'got expected installation message' );
+    }
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my($fullname);
+
+    # Case where element in @files is not an array ref
+    my @files = ( q{} );
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 0, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() handled invalid argument as expected' );
+    
+        like( $stdout, qr/Installing \.\.\./, 
+            'got expected installation message' );
+    }
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my($fullname);
+
+    # Case where element in @files does not hold existent file
+    my $nonexistent = q{ajdpfadksjfjvjkvds} . $$;
+    my @files = ( [ $nonexistent, "$dirs[0]/$nonexistent"] );
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 0, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() handled non-existent file as expected' );
+    
+        like( $stdout, qr/Installing \.\.\./, 
+            'got expected installation message' );
+    }
+}
+
+# Can't safely run lines_to_files() more than once in a program until it's been fixed, 
+# and we can't fix it until its tested, so I've commented most of these out until we've
+# fixed lines_to_files() not to use @ARGV
+{
+    my($metatransforms, $othertransforms, $manifests, $options, $parrotdir,
+        $files, $installable_exe, $directories);
+
+    # First lines_to_files test
+#    eval { lines_to_files(); };
+#    $@ or die "lines_to_files didn't die with no parameters\n";
+#    ok($@ =~ /^.manifests must be an array reference$/, 'lines_to_files dies with bad parameters');
+
+    # Second lines_to_files test
+#    eval { lines_to_files(
+#        $metatransforms, $othertransforms, 
+#        [qw(MANIFEST MANIFEST.generated)], 
+#        $options, $parrotdir
+#    ); };
+#    ok($@ =~ /^Unknown install location in MANIFEST for file/, 'fails for install locations not specified in transforms');
+
+    # Third lines_to_files test
+    $metatransforms = {
+        doc => {
+            optiondir => 'doc',
+            transform => sub {
+                my($dest) = @_;
+                $dest =~ s/^docs\/resources/resources/; # resources go in the top level of docs
+                $dest =~ s/^docs/pod/; # other docs are actually raw Pod
+                $parrotdir, $dest;
+            },
+        },
+    };
+    $othertransforms = {
+        '.*' => {
+            optiondir => 'foo',
+            transform => sub {
+                return(@_);
+            }
+        }
+    };
+
+    ($files, $installable_exe, $directories) = lines_to_files(
+        $metatransforms, $othertransforms, 
+        [qw(MANIFEST MANIFEST.generated)], 
+        { packages => 'main' }, $parrotdir
+    );
+    ok((ref($files) and ref($installable_exe) and ref($directories)), 'lines_to_files returns something vaguely sensible');
+    ok(1, 'lines_to_files passed all tests');
+}
+
+pass("Completed all tests in $0");
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Deleted: branches/install_tools/t/tools/install/01-install_files.t
==============================================================================
--- branches/install_tools/t/tools/install/01-install_files.t	Sat Apr  4 15:01:33 2009	(r37900)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,253 +0,0 @@
-#! perl
-# Copyright (C) 2007, Parrot Foundation.
-# $Id$
-# 01-install_files.t
-
-use strict;
-use warnings;
-
-use Test::More qw(no_plan); # tests =>  8;
-use Carp;
-use File::Path qw( mkpath );
-use File::Temp qw( tempdir );
-use lib qw( lib );
-use Parrot::Install qw(
-    install_files
-    create_directories
-    lines_to_files
-);
-use IO::CaptureOutput qw( capture );
-
-################### DOCUMENTATION ###################
-
-=head1 NAME
-
-01-install_files.t - test subroutines exported by C<Parrot::Install>
-
-=head1 SYNOPSIS
-
-    % prove t/tools/install/01-install_files.t
-
-=head1 DESCRIPTION
-
-The files in this directory test functionality used by
-F<tools/dev/install_files.pl> and F<tools/dev/install_dev_files.pl> and
-exported by F<lib/Parrot/Install.pm>.
-
-=head1 AUTHOR
-
-James E Keenan
-
-=head1 SEE ALSO
-
-Parrot::Install, F<tools/dev/install_files.pl>, F<tools/dev/install_dev_files.pl>
-
-=cut
-
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    $tdir .= '/';
-
-    my @dirs = qw(foo/bar foo/bar/baz);
-    create_directories($tdir, { map { $_ => 1 } @dirs });
-    my $dirs_seen = 0;
-    foreach my $d (@dirs) {
-        $dirs_seen++ if -d "$tdir$d";
-    }
-    is($dirs_seen, 2, 'got expected number of directories created');
-}
-
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    $tdir .= '/';
-
-    my @dirs = qw(foo/bar foo/bar/baz);
-    my @created = mkpath( "$tdir$dirs[0]" );
-    ok( ( -d $created[0] ),
-        "one directory created before create_directories() is called" );
-
-    create_directories($tdir, { map { $_ => 1 } @dirs });
-    my $dirs_seen = 0;
-    foreach my $d (@dirs) {
-        $dirs_seen++ if -d "$tdir$d";
-    }
-    is($dirs_seen, 2,
-        "create_directories() handled case where one directory already existed" );
-}
-
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    $tdir .= '/';
-
-    my @dirs = qw(foo/bar foo/bar/baz);
-    my @created = mkpath( $tdir . 'foo' );
-    ok( ( -d $created[0] ),
-        "one directory created before create_directories() is called" );
-
-    create_directories($tdir, { map { $_ => 1 } @dirs });
-    my $dirs_seen = 0;
-    foreach my $d (@dirs) {
-        $dirs_seen++ if -d "$tdir$d";
-    }
-    is($dirs_seen, 2,
-        "create_directories() handled case where one path partially existed" );
-}
-
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    $tdir .= '/';
-
-    my @dirs = qw(foo/bar foo/bar/baz);
-    create_directories($tdir, { map { $_ => 1 } @dirs });
-    my($fullname);
-
-    my @files = ( ['README', "$dirs[0]/README"] );
-
-    {
-        my ( $stdout, $stderr, $rv );
-        capture(
-            sub { $rv = install_files($tdir, 1, @files); },
-            \$stdout,
-            \$stderr,
-        );
-        ok( $rv, 'install_files() completed successfully in dry-run case' );
-    
-        my $files_created = 0;
-        foreach my $el (@files) {
-            $files_created++ if -f "$tdir$el->[1]";
-        }
-        is( $files_created, 0, 'dry-run, so no files created' );
-
-        like( $stdout, qr/Installing.*README.*README/s,
-            'got expected installation message' );
-    }
-
-    {
-        my ( $stdout, $stderr, $rv );
-        capture(
-            sub { $rv = install_files($tdir, 0, @files); },
-            \$stdout,
-            \$stderr,
-        );
-        ok( $rv, 'install_files() completed successfully in production case' );
-    
-        my $files_created = 0;
-        foreach my $el (@files) {
-            $files_created++ if -f "$tdir$el->[1]";
-        }
-        is( $files_created, 1, 'production, so 1 file created' );
-
-        like( $stdout, qr/Installing.*README/s,
-            'got expected installation message' );
-    }
-}
-
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    $tdir .= '/';
-
-    my @dirs = qw(foo/bar foo/bar/baz);
-    create_directories($tdir, { map { $_ => 1 } @dirs });
-    my($fullname);
-
-    # Case where element in @files is not an array ref
-    my @files = ( q{} );
-
-    {
-        my ( $stdout, $stderr, $rv );
-        capture(
-            sub { $rv = install_files($tdir, 0, @files); },
-            \$stdout,
-            \$stderr,
-        );
-        ok( $rv, 'install_files() handled invalid argument as expected' );
-    
-        like( $stdout, qr/Installing \.\.\./, 
-            'got expected installation message' );
-    }
-}
-
-{
-    my $tdir = tempdir( CLEANUP => 1 );
-    $tdir .= '/';
-
-    my @dirs = qw(foo/bar foo/bar/baz);
-    create_directories($tdir, { map { $_ => 1 } @dirs });
-    my($fullname);
-
-    # Case where element in @files does not hold existent file
-    my $nonexistent = q{ajdpfadksjfjvjkvds} . $$;
-    my @files = ( [ $nonexistent, "$dirs[0]/$nonexistent"] );
-
-    {
-        my ( $stdout, $stderr, $rv );
-        capture(
-            sub { $rv = install_files($tdir, 0, @files); },
-            \$stdout,
-            \$stderr,
-        );
-        ok( $rv, 'install_files() handled non-existent file as expected' );
-    
-        like( $stdout, qr/Installing \.\.\./, 
-            'got expected installation message' );
-    }
-}
-
-# Can't safely run lines_to_files() more than once in a program until it's been fixed, 
-# and we can't fix it until its tested, so I've commented most of these out until we've
-# fixed lines_to_files() not to use @ARGV
-{
-    my($metatransforms, $othertransforms, $manifests, $options, $parrotdir,
-        $files, $installable_exe, $directories);
-
-    # First lines_to_files test
-#    eval { lines_to_files(); };
-#    $@ or die "lines_to_files didn't die with no parameters\n";
-#    ok($@ =~ /^.manifests must be an array reference$/, 'lines_to_files dies with bad parameters');
-
-    # Second lines_to_files test
-#    eval { lines_to_files(
-#        $metatransforms, $othertransforms, 
-#        [qw(MANIFEST MANIFEST.generated)], 
-#        $options, $parrotdir
-#    ); };
-#    ok($@ =~ /^Unknown install location in MANIFEST for file/, 'fails for install locations not specified in transforms');
-
-    # Third lines_to_files test
-    $metatransforms = {
-        doc => {
-            optiondir => 'doc',
-            transform => sub {
-                my($dest) = @_;
-                $dest =~ s/^docs\/resources/resources/; # resources go in the top level of docs
-                $dest =~ s/^docs/pod/; # other docs are actually raw Pod
-                $parrotdir, $dest;
-            },
-        },
-    };
-    $othertransforms = {
-        '.*' => {
-            optiondir => 'foo',
-            transform => sub {
-                return(@_);
-            }
-        }
-    };
-
-    ($files, $installable_exe, $directories) = lines_to_files(
-        $metatransforms, $othertransforms, 
-        [qw(MANIFEST MANIFEST.generated)], 
-        { packages => 'main' }, $parrotdir
-    );
-    ok((ref($files) and ref($installable_exe) and ref($directories)), 'lines_to_files returns something vaguely sensible');
-    ok(1, 'lines_to_files passed all tests');
-}
-
-pass("Completed all tests in $0");
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Copied: branches/install_tools/t/tools/install/02-install_files.t (from r37894, branches/install_tools/t/tools/install/01-install_files.t)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/install_tools/t/tools/install/02-install_files.t	Sat Apr  4 15:01:33 2009	(r37901, copy of r37894, branches/install_tools/t/tools/install/01-install_files.t)
@@ -0,0 +1,253 @@
+#! perl
+# Copyright (C) 2007, Parrot Foundation.
+# $Id$
+# 01-install_files.t
+
+use strict;
+use warnings;
+
+use Test::More qw(no_plan); # tests =>  8;
+use Carp;
+use File::Path qw( mkpath );
+use File::Temp qw( tempdir );
+use lib qw( lib );
+use Parrot::Install qw(
+    install_files
+    create_directories
+    lines_to_files
+);
+use IO::CaptureOutput qw( capture );
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+01-install_files.t - test subroutines exported by C<Parrot::Install>
+
+=head1 SYNOPSIS
+
+    % prove t/tools/install/01-install_files.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by
+F<tools/dev/install_files.pl> and F<tools/dev/install_dev_files.pl> and
+exported by F<lib/Parrot/Install.pm>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Install, F<tools/dev/install_files.pl>, F<tools/dev/install_dev_files.pl>
+
+=cut
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my $dirs_seen = 0;
+    foreach my $d (@dirs) {
+        $dirs_seen++ if -d "$tdir$d";
+    }
+    is($dirs_seen, 2, 'got expected number of directories created');
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    my @created = mkpath( "$tdir$dirs[0]" );
+    ok( ( -d $created[0] ),
+        "one directory created before create_directories() is called" );
+
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my $dirs_seen = 0;
+    foreach my $d (@dirs) {
+        $dirs_seen++ if -d "$tdir$d";
+    }
+    is($dirs_seen, 2,
+        "create_directories() handled case where one directory already existed" );
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    my @created = mkpath( $tdir . 'foo' );
+    ok( ( -d $created[0] ),
+        "one directory created before create_directories() is called" );
+
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my $dirs_seen = 0;
+    foreach my $d (@dirs) {
+        $dirs_seen++ if -d "$tdir$d";
+    }
+    is($dirs_seen, 2,
+        "create_directories() handled case where one path partially existed" );
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my($fullname);
+
+    my @files = ( ['README', "$dirs[0]/README"] );
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 1, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() completed successfully in dry-run case' );
+    
+        my $files_created = 0;
+        foreach my $el (@files) {
+            $files_created++ if -f "$tdir$el->[1]";
+        }
+        is( $files_created, 0, 'dry-run, so no files created' );
+
+        like( $stdout, qr/Installing.*README.*README/s,
+            'got expected installation message' );
+    }
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 0, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() completed successfully in production case' );
+    
+        my $files_created = 0;
+        foreach my $el (@files) {
+            $files_created++ if -f "$tdir$el->[1]";
+        }
+        is( $files_created, 1, 'production, so 1 file created' );
+
+        like( $stdout, qr/Installing.*README/s,
+            'got expected installation message' );
+    }
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my($fullname);
+
+    # Case where element in @files is not an array ref
+    my @files = ( q{} );
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 0, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() handled invalid argument as expected' );
+    
+        like( $stdout, qr/Installing \.\.\./, 
+            'got expected installation message' );
+    }
+}
+
+{
+    my $tdir = tempdir( CLEANUP => 1 );
+    $tdir .= '/';
+
+    my @dirs = qw(foo/bar foo/bar/baz);
+    create_directories($tdir, { map { $_ => 1 } @dirs });
+    my($fullname);
+
+    # Case where element in @files does not hold existent file
+    my $nonexistent = q{ajdpfadksjfjvjkvds} . $$;
+    my @files = ( [ $nonexistent, "$dirs[0]/$nonexistent"] );
+
+    {
+        my ( $stdout, $stderr, $rv );
+        capture(
+            sub { $rv = install_files($tdir, 0, @files); },
+            \$stdout,
+            \$stderr,
+        );
+        ok( $rv, 'install_files() handled non-existent file as expected' );
+    
+        like( $stdout, qr/Installing \.\.\./, 
+            'got expected installation message' );
+    }
+}
+
+# Can't safely run lines_to_files() more than once in a program until it's been fixed, 
+# and we can't fix it until its tested, so I've commented most of these out until we've
+# fixed lines_to_files() not to use @ARGV
+{
+    my($metatransforms, $othertransforms, $manifests, $options, $parrotdir,
+        $files, $installable_exe, $directories);
+
+    # First lines_to_files test
+#    eval { lines_to_files(); };
+#    $@ or die "lines_to_files didn't die with no parameters\n";
+#    ok($@ =~ /^.manifests must be an array reference$/, 'lines_to_files dies with bad parameters');
+
+    # Second lines_to_files test
+#    eval { lines_to_files(
+#        $metatransforms, $othertransforms, 
+#        [qw(MANIFEST MANIFEST.generated)], 
+#        $options, $parrotdir
+#    ); };
+#    ok($@ =~ /^Unknown install location in MANIFEST for file/, 'fails for install locations not specified in transforms');
+
+    # Third lines_to_files test
+    $metatransforms = {
+        doc => {
+            optiondir => 'doc',
+            transform => sub {
+                my($dest) = @_;
+                $dest =~ s/^docs\/resources/resources/; # resources go in the top level of docs
+                $dest =~ s/^docs/pod/; # other docs are actually raw Pod
+                $parrotdir, $dest;
+            },
+        },
+    };
+    $othertransforms = {
+        '.*' => {
+            optiondir => 'foo',
+            transform => sub {
+                return(@_);
+            }
+        }
+    };
+
+    ($files, $installable_exe, $directories) = lines_to_files(
+        $metatransforms, $othertransforms, 
+        [qw(MANIFEST MANIFEST.generated)], 
+        { packages => 'main' }, $parrotdir
+    );
+    ok((ref($files) and ref($installable_exe) and ref($directories)), 'lines_to_files returns something vaguely sensible');
+    ok(1, 'lines_to_files passed all tests');
+}
+
+pass("Completed all tests in $0");
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:


More information about the parrot-commits mailing list