2 # Copyright (C) 2007, The Perl 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 => 13;
25 use IO::CaptureOutput qw| capture |;
26 use_ok( 'Parrot::Ops2pm::Auxiliary', qw| Usage getoptions | );
28 ok( chdir $main::topdir, "Positioned at top-level Parrot directory" );
31 my ($stdout, $stderr);
39 qr|^usage: tools/build/ops2pm\.pl \[--help\] \[--no-lines\] input\.ops \[input2\.ops \.\.\.\]|,
40 "Got expected usage message"
45 local @ARGV = qw( --no-lines );
46 my $flagsref = getoptions();
47 ok( $flagsref->{nolines}, "no-lines option detected" );
48 ok( !defined $flagsref->{help}, "help option not defined" );
49 ok( !defined $flagsref->{renum}, "renum option not defined" );
54 my $flagsref = getoptions();
55 ok( !defined $flagsref->{nolines}, "no-lines option not defined" );
56 ok( !defined $flagsref->{help}, "help option not defined" );
57 ok( !defined $flagsref->{renum}, "renum option not defined" );
61 local @ARGV = qw( --no-lines --help --renum );
62 my $flagsref = getoptions();
63 ok( $flagsref->{nolines}, "no-lines option detected" );
64 ok( $flagsref->{help}, "help option detected" );
65 ok( $flagsref->{renum}, "renum option detected" );
68 pass("Completed all tests in $0");
70 ################### DOCUMENTATION ###################
74 02-usage.t - test C<Parrot::Ops2pm::Utils::Usage()>
78 % prove t/tools/ops2pmutils/02-usage.t
82 The files in this directory test the publicly callable subroutines of
83 F<lib/Parrot/Ops2pm/Utils.pm> and F<lib/Parrot/Ops2pm/Auxiliary.pm>.
84 By doing so, they test the functionality of the F<ops2pm.pl> utility.
85 That functionality has largely been extracted
86 into the methods of F<Utils.pm>.
88 F<02-usage.t> tests whether C<Parrot::Ops2pm::Auxiliary::Usage()>
97 Parrot::Ops2pm::Auxiliary, F<ops2pm.pl>.
103 # cperl-indent-level: 4
106 # vim: expandtab shiftwidth=4: