[svn:parrot] r49442 - in trunk: . t/tools
dukeleto at svn.parrot.org
dukeleto at svn.parrot.org
Mon Oct 4 20:02:32 UTC 2010
Author: dukeleto
Date: Mon Oct 4 20:02:31 2010
New Revision: 49442
URL: https://trac.parrot.org/parrot/changeset/49442
Log:
[t] Add some basic tests for create_language.pl
Added:
trunk/t/tools/create_language.t (contents, props changed)
Modified:
trunk/MANIFEST
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Mon Oct 4 13:50:48 2010 (r49441)
+++ trunk/MANIFEST Mon Oct 4 20:02:31 2010 (r49442)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Oct 4 13:50:13 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Oct 4 19:58:48 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -2041,6 +2041,7 @@
t/steps/inter/yacc-01.t [test]
t/steps/inter/yacc-02.t [test]
t/stress/gc.t [test]
+t/tools/create_language.t [test]
t/tools/dev/pmctree.t [test]
t/tools/dev/searchops.t [test]
t/tools/dev/searchops/samples.pm [test]
Added: trunk/t/tools/create_language.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/t/tools/create_language.t Mon Oct 4 20:02:31 2010 (r49442)
@@ -0,0 +1,89 @@
+#! perl
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/tools/create_language.t - test create_language.pl
+
+=head1 SYNOPSIS
+
+ % prove t/tools/create_language.t - test create_language.pl
+
+=head1 DESCRIPTION
+
+Tests the C<tools/dev/create_language.pl> 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::Functions;
+use File::Path qw/remove_tree/;
+
+my ($path, $exefile);
+
+BEGIN {
+ $path = catfile( ".", qw/tools dev create_language.pl/ );
+ $exefile = $path . $PConfig{exe};
+ unless ( -f $exefile ) {
+ plan skip_all => "$exefile hasn't been built yet.";
+ exit(0);
+ }
+ plan tests => 6;
+}
+
+create_output_like(
+ "test_parrot_language_$$",
+ qr{creating test_parrot_language_},
+ 'create_language basic sanity'
+);
+
+my $lang_dir = "test_parrot_language_$$";
+my $build_dir = catfile($lang_dir, "build");
+my $test_dir = catfile($lang_dir, "t");
+my $src_dir = catfile($lang_dir, "src");
+my $config = catfile($lang_dir, "Configure.pl");
+ok(-e $lang_dir, "$lang_dir dir exists");
+ok(-e $build_dir, "$build_dir dir exists");
+ok(-e $test_dir, "$test_dir dir exists");
+ok(-e $src_dir, "$src_dir dir exists");
+ok(-s $config, "$config exists and has nonzero size");
+
+
+=head1 HELPER SUBROUTINES
+
+=head2 create_output_like
+
+ create_output_like($keys, /regexp/, $description);
+
+Runs create_language with $keys as the argument and verifies the output.
+
+=cut
+
+sub create_output_like {
+ my ($options, $snippet, $desc) = @_;
+
+ my $out = `$^X $exefile $options`;
+
+ like( $out, $snippet, $desc );
+
+ return;
+}
+
+END {
+ remove_tree("test_parrot_language_$$");
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
More information about the parrot-commits
mailing list