[svn:parrot] r47624 - in trunk: . t/tools
coke at svn.parrot.org
coke at svn.parrot.org
Mon Jun 14 16:57:14 UTC 2010
Author: coke
Date: Mon Jun 14 16:57:14 2010
New Revision: 47624
URL: https://trac.parrot.org/parrot/changeset/47624
Log:
Add minimal tests for parrot_config.
Resolves TT #626
Added:
trunk/t/tools/parrot_config.t (contents, props changed)
Modified:
trunk/MANIFEST
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Mon Jun 14 16:42:15 2010 (r47623)
+++ trunk/MANIFEST Mon Jun 14 16:57:14 2010 (r47624)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Jun 13 02:03:00 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Jun 14 16:49:50 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -2069,6 +2069,7 @@
t/tools/install/testlib/src/pmc/pmc_object.h [test]
t/tools/install/testlib/tools/build/ops2c.pl [test]
t/tools/install/testlib/vtable.dump [test]
+t/tools/parrot_config.t [test]
t/tools/parrot_debugger.t [test]
t/tools/pbc_disassemble.t [test]
t/tools/pbc_dump.t [test]
Added: trunk/t/tools/parrot_config.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/t/tools/parrot_config.t Mon Jun 14 16:57:14 2010 (r47624)
@@ -0,0 +1,84 @@
+#! perl
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/tools/parrot_config.t - test parrot_config
+
+=head1 SYNOPSIS
+
+ % prove t/tools/parrot_config.t - test parrot_config
+
+=head1 DESCRIPTION
+
+Tests the C<parrot_config> tool.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw(lib);
+
+use Test::More;
+use IO::File ();
+use Parrot::Config;
+use Parrot::Test;
+use File::Spec;
+
+my ($path, $exefile);
+
+BEGIN {
+ $path = File::Spec->catfile( ".", "parrot_config" );
+ $exefile = $path . $PConfig{exe};
+ unless ( -f $exefile ) {
+ plan skip_all => "$exefile hasn't been built yet.";
+ exit(0);
+ }
+ plan tests => 3;
+}
+
+config_output_like(
+ 'pmc_names',
+ qr/\bHash\b/,
+ 'parrot_config basic sanity'
+);
+
+config_output_like(
+ 'non_existant_key',
+ qr/no such key: 'non_existant_key'/,
+ 'missing keys'
+);
+
+config_output_like(
+ 'slash has_icu',
+ qr/slash \s+ => \s+ '.' \n has_icu \s+ => \s+ '.'/x,
+ 'multiple keys'
+);
+
+=head1 HELPER SUBROUTINES
+
+=head2 dump_output_like
+
+ config_output_like($keys, /regexp/, $description);
+
+Runs parrot_config with $keys as the argument and verifies the output.
+
+=cut
+
+sub config_output_like {
+ my ($options, $snippet, $desc) = @_;
+
+ my $out = `$exefile $options`;
+
+ like( $out, $snippet, $desc );
+
+ return;
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
More information about the parrot-commits
mailing list