#!./perl -w
chdir 't' if -d 't';
@INC = ('../lib', 'lib', '.'); }
}
plan( 9 );
# And someone's responsible.
# use() makes it difficult to avoid O::import()
my @
args =
('-Ilib', '-MO=success,foo,bar', '-e', '1' );
is( $lines[0], 'Compiling!', 'Output should not be saved without -q switch' );
is( $lines[1], '(foo) <bar>', 'O.pm should call backend compile() method' );
is( $lines[2], '[]', 'Nothing should be in $O::BEGIN_output without -q' );
is( $lines[3], '-e syntax OK', 'O.pm should not munge perl output without -qq');
$args[
1] =
'-MO=-q,success,foo,bar';
isnt( $lines[1], 'Compiling!', 'Output should not be printed with -q switch' );
skip( '-q redirection does not work without PerlIO', 2) is( $lines[1], "[Compiling!", '... but should be in $O::BEGIN_output' );
$args[1] = '-MO=-qq,success,foo,bar'; is( scalar @lines, 3, '-qq should suppress even the syntax OK message' ); }
$args[
1] =
'-MO=success,fail';
'O.pm should die if backend compile() does not return a subref' );
}
rmdir($path); # not "1 while" since there might be more in there }
$| = 1;
print "Compiling!\n";
return 'fail' if ($_[0] eq 'fail'); print "($_[0]) <$_[1]>\n";
return sub { print "[$O::BEGIN_output]\n" };
}
1;