2 # Copyright (C) 2007-2008, Parrot Foundation.
11 use Cwd qw(cwd realpath);
12 realpath($Bin) =~ m{^(.*\/parrot)\/[^/]*\/[^/]*\/[^/]*$};
14 if ( defined $topdir ) {
15 print "\nOK: Parrot top directory located\n";
18 $topdir = realpath($Bin) . "/../../..";
20 unshift @INC, qq{$topdir/lib};
22 use Test::More tests => 14;
25 use File::Temp (qw| tempdir |);
27 use_ok('Parrot::Ops2pm');
29 use constant NUM_FILE => "src/ops/ops.num";
30 use constant SKIP_FILE => "src/ops/ops.skip";
32 ok( chdir $main::topdir, "Positioned at top-level Parrot directory" );
34 # fail to provide ops.skip file
42 my $tdir = tempdir( CLEANUP => 1 );
43 ok( chdir $tdir, 'changed to temp directory for testing' );
44 ok( ( mkdir qq{$tdir/src} ), "able to make tempdir/src" );
45 ok( ( mkdir qq{$tdir/src/ops} ), "able to make tempdir/src" );
46 foreach my $f (@ARGV) {
47 ok( copy( qq{$cwd/$f}, qq{$tdir/$f} ), "copied .ops file" );
51 ok( copy( qq{$cwd/$num}, qq{$tdir/$num} ), "copied ops.num file" );
53 # ok(copy(qq{$cwd/$skip}, qq{$tdir/$skip}), "copied ops.skip file");
54 my @opsfiles = glob("./src/ops/*.ops");
56 my $self = Parrot::Ops2pm->new(
59 script => "tools/build/ops2pm.pl",
64 isa_ok( $self, q{Parrot::Ops2pm} );
66 ok( $self->prepare_ops, "prepare_ops() returned successfully" );
67 ok( defined( $self->{ops} ), "'ops' key has been defined" );
69 eval { $self->load_op_map_files(); };
71 $@, qr|^Can't open.*src/ops/ops\.skip|, #'
72 "Failure to prove ops.skip correctly detected"
75 ok( chdir $cwd, 'changed back to starting directory after testing' );
79 pass("Completed all tests in $0");
81 ################### DOCUMENTATION ###################
85 07-no_ops_skip.t - test C<Parrot::Ops2pm::no_ops_skip()>
89 % prove t/tools/ops2pm/07-no_ops_skip.t
93 The files in this directory test the publicly callable subroutines of
94 F<lib/Parrot/Ops2pm.pm> and F<lib/Parrot/Ops2pm/Auxiliary.pm>.
95 By doing so, they test the functionality of the F<ops2pm.pl> utility.
96 That functionality has largely been extracted
97 into the methods of F<Utils.pm>.
99 F<07-no_ops_skip.t> tests what happens when there is no F<src/ops/ops.skip>
100 available for C<load_op_map_files()> to evaluate.
108 Parrot::Ops2pm, F<ops2pm.pl>.
114 # cperl-indent-level: 4
117 # vim: expandtab shiftwidth=4: