2 # Copyright (C) 2005-2006, Parrot Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 4;
14 t/examples/library.t - Test examples in F<examples/library>
18 % prove t/examples/library.t
22 Test the examples in F<examples/library>.
30 # Set up expected output of the examples
32 'getopt_demo.pir' => <<'END_EXPECTED',
33 Hi, I am 'getopt_demo.pir'.
35 You haven't passed the option '--bool'. This is fine with me.
36 You haven't passed the option '--string'. This is fine with me.
37 You haven't passed the option '--integer'. This is fine with me.
38 All args have been parsed.
44 while ( my ( $example, $expected ) = each %expected ) {
45 example_output_is( "examples/library/$example", $expected );
48 my $PARROT = File::Spec->catfile( File::Spec->curdir(), $PConfig{test_prog} );
50 # For testing md5sum.pir we need to pass a filename
52 my $md5sum_fn = File::Spec->catfile(qw( examples library md5sum.pir ));
53 my $sample_fn = File::Spec->catfile(qw( t library perlhist.txt ));
54 my $sum = `$PARROT $md5sum_fn $sample_fn`;
55 is( $sum, "fb171bd1a17bf6cd08d73105ad738a35\t$sample_fn\n", $md5sum_fn );
60 skip( 'no pcre-config', 1 ); # Original check for PCRE flawed (TT #406)
62 my $pcre_fn = File::Spec->catfile(qw( examples library pcre.pir ));
63 my $test_out = `$PARROT $pcre_fn asdf as`;
64 is( $test_out, <<'END_EXPECTED', $pcre_fn );
73 local $TODO = 'ncurses_life.pir not testable yet';
74 fail('ncurses_life.pir');
79 # cperl-indent-level: 4
82 # vim: expandtab shiftwidth=4: