Author: bernhard
Date: Thu Oct 13 14:35:35 2005
New Revision: 9481
Added:
trunk/t/run/README
trunk/t/run/first.pir
trunk/t/run/options.t
trunk/t/run/second.pir
Modified:
trunk/MANIFEST
trunk/config/gen/makefiles/root.in
trunk/t/examples/library.t
trunk/t/harness
trunk/t/run/exit.t
trunk/t/src/README
Log:
Started t/run/options.t for testing Parrot command line.
Detabify t/harness.
Strictiy t/run/exit.t
Test md5sum.pir with 'perlhist.txt'
t/run/*.t was tested twice by 'make test'
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Thu Oct 13 14:35:35 2005
@@ -1936,6 +1936,10 @@ t/library/sort.t
t/library/streams.t []
t/library/yaml_parser_syck.t []
t/run/exit.t []
+t/run/README []
+t/run/first.pir []
+t/run/options.t []
+t/run/second.pir []
t/src/README []
t/src/basic.t []
t/src/compiler.t []
Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in (original)
+++ trunk/config/gen/makefiles/root.in Thu Oct 13 14:35:35 2005
@@ -1214,7 +1214,6 @@ PERL_TEST_FILES = \
RUNCORE_TEST_FILES = \
t/op/*.t \
t/pmc/*.t \
- t/run/*.t \
t/native_pbc/*.t \
$(IMCC_DIR)/t/*/*.t \
t/library/*.t \
Modified: trunk/t/examples/library.t
==============================================================================
--- trunk/t/examples/library.t (original)
+++ trunk/t/examples/library.t Thu Oct 13 14:35:35 2005
@@ -68,9 +68,9 @@ while ( my ( $example, $expected ) = eac
# For testing md5sum.pir we need to pass a filename
{
my $md5sum_fn = "examples$PConfig{slash}library$PConfig{slash}md5sum.pir";
- my $sample_fn = "examples$PConfig{slash}README";
+ my $sample_fn = "t$PConfig{slash}library$PConfig{slash}perlhist.txt";
my $sum = `$PARROT $md5sum_fn $sample_fn`;
- is( $sum, "cba989d2bebdce8f56f69c3f0d54ae15\t$sample_fn\n", $md5sum_fn );
+ is( $sum, "fb171bd1a17bf6cd08d73105ad738a35\t$sample_fn\n", $md5sum_fn );
}
Modified: trunk/t/harness
==============================================================================
--- trunk/t/harness (original)
+++ trunk/t/harness Thu Oct 13 14:35:35 2005
@@ -139,37 +139,36 @@ unless ($html) {
runtests(@tests);
} else {
my @smoke_config_vars = qw(
- osname
+ osname
archname
cc
build_dir
cpuarch
revision
- VERSION
- optimize
- DEVEL
+ VERSION
+ optimize
+ DEVEL
);
eval {
require Test::TAP::HTMLMatrix;
require Test::TAP::Model::Visual;
};
-
die "You must have Test::TAP::HTMLMatrix installed.\n\n$@" if $@;
- my $start = time;
+ my $start = time;
my $model = Test::TAP::Model::Visual->new_with_tests(@tests);
- my $end = time;
+ my $end = time;
- my $duration = $end - $start;
+ my $duration = $end - $start;
my $v = Test::TAP::HTMLMatrix->new(
$model,
join("\n",
- "duration: $duration",
- "branch: unknown",
- "harness_args: " . (($args) ? $args : "N/A"),
- map { "$_: $PConfig{$_}" } sort @smoke_config_vars),
+ "duration: $duration",
+ "branch: unknown",
+ "harness_args: " . (($args) ? $args : "N/A"),
+ map { "$_: $PConfig{$_}" } sort @smoke_config_vars),
);
$v->has_inline_css(1); # no separate css file
Added: trunk/t/run/README
==============================================================================
--- (empty file)
+++ trunk/t/run/README Thu Oct 13 14:35:35 2005
@@ -0,0 +1,4 @@
+# Copyright: 2005 The Perl Foundation. All Rights Reserved.
+# $Id: README 7635 2005-03-14 19:49:59Z bernhard $
+
+This directory contains tests for the stuff documented in docs/running.pod.
Modified: trunk/t/run/exit.t
==============================================================================
--- trunk/t/run/exit.t (original)
+++ trunk/t/run/exit.t Thu Oct 13 14:35:35 2005
@@ -9,7 +9,7 @@ t/run/exit.t - test parrot exit codes
=head1 SYNOPSIS
- % perl -Ilib t/run/exit.t
+ % perl -Ilib t/run/exit.t
=head1 DESCRIPTION
@@ -18,16 +18,15 @@ with combinations of STDERR and STDOUT o
=cut
+use strict;
use Parrot::Test tests => 8;
use Test::More;
use Parrot::Config;
-$PARROT = ".$PConfig{slash}$PConfig{test_prog}";
+my $PARROT = ".$PConfig{slash}$PConfig{test_prog}";
# windows wants '>nul', most everything else wants '>/dev/null'
-my $redir = $^O =~ /^(MSWin\d+)$/
- ? q{>nul 2>&1}
- : q{>/dev/null 2>&1};
+my $redir = $^O =~ /^(MSWin\d+)$/ ? q{>nul 2>&1} : q{>/dev/null 2>&1};
# copy file descriptors
open OLDOUT, ">&STDOUT";
@@ -35,11 +34,11 @@ open OLDERR, ">&STDERR";
sub exits
{
- my $pre = shift;
- $pre ||= '';
+ my $pre = shift;
+ $pre ||= '';
- is( system(qq|$PARROT --version $redir|) >> 8, 0, "$pre: normal exit" );
- isnt( system(qq|$PARROT --foo $redir|) >> 8, 0, "$pre: abnormal exit" );
+ is( system(qq|$PARROT --version $redir|) >> 8, 0, "$pre: normal exit" );
+ isnt( system(qq|$PARROT --foo $redir|) >> 8, 0, "$pre: abnormal exit" );
}
# all open
Added: trunk/t/run/first.pir
==============================================================================
--- (empty file)
+++ trunk/t/run/first.pir Thu Oct 13 14:35:35 2005
@@ -0,0 +1,18 @@
+# Copyright: 2005 The Perl Foundation. All Rights Reserved.
+# $Id$
+
+=head1 NAME
+
+first.pir - used for testing parrot command line options
+
+=head1 DESCRIPTION
+
+Test what happens when multiple files are passed to parrot
+
+=cut
+
+.sub 'first' :main
+
+ print "first\n"
+
+.end
Added: trunk/t/run/options.t
==============================================================================
--- (empty file)
+++ trunk/t/run/options.t Thu Oct 13 14:35:35 2005
@@ -0,0 +1,48 @@
+# Copyright: 2005 The Perl Foundation. All Rights Reserved.
+# $Id$
+
+=head1 NAME
+
+t/run/options.t - test parrot command line options
+
+=head1 SYNOPSIS
+
+ % perl -Ilib t/run/options.t
+
+ % perl t/harness t/run/options.t
+
+=head1 DESCRIPTION
+
+Tests C<parrot> command line options.
+
+=cut
+
+use strict;
+use Parrot::Test tests => 10;
+use Test::More;
+use Parrot::Config;
+
+my $PARROT = ".$PConfig{slash}$PConfig{test_prog}";
+
+# looking at the help message
+my $help_message = `$PARROT --help`;
+is( substr( $help_message, 0, 23 ), 'parrot [Options] <file>', 'Start of help
message' );
+ok( index( $help_message, '-t --trace [flags]' ) > 0, 'help for --trace' );
+
+# executing a PIR file
+is( `$PARROT t/run/first.pir`, "first\n", 'running first.pir' );
+is( `$PARROT t/run/second.pir`, "second\n", 'running second.pir' );
+
+# Ignore further arguments
+is( `$PARROT t/run/first.pir second.pir`, "first\n", 'ignore a pir-file' );
+is( `$PARROT t/run/first.pir asdf`, "first\n", 'ignore nonsense' );
+
+# Test the trace option
+is( `$PARROT -t t/run/first.pir`, "first\n", 'option -t' );
+TODO:
+{
+ local $TODO = '--trace behaves not like -t';
+ is( `$PARROT --trace t/run/first.pir`, "first\n", 'option --trace' );
+};
+is( `$PARROT -t t/run/first.pir t/run/second.pir`, "second\n", 'option -t with
flags' );
+is( `$PARROT --trace t/run/first.pir t/run/second.pir`, "second\n", 'option
--trace with flags' );
Added: trunk/t/run/second.pir
==============================================================================
--- (empty file)
+++ trunk/t/run/second.pir Thu Oct 13 14:35:35 2005
@@ -0,0 +1,18 @@
+# Copyright: 2005 The Perl Foundation. All Rights Reserved.
+# $Id$
+
+=head1 NAME
+
+second.pir - used for testing parrot command line options
+
+=head1 DESCRIPTION
+
+Test what happens when multiple files are passed to parrot
+
+=cut
+
+.sub 'second' :main
+
+ print "second\n"
+
+.end
Modified: trunk/t/src/README
==============================================================================
--- trunk/t/src/README (original)
+++ trunk/t/src/README Thu Oct 13 14:35:35 2005
@@ -2,4 +2,4 @@
# $Id$
This directory contains test code in C.
-See also the documentation in ../../doc/tests.pod.
+See also the documentation in ../../docs/tests.pod.