[svn:parrot] r49443 - in trunk: . t/tools

dukeleto at svn.parrot.org dukeleto at svn.parrot.org
Mon Oct 4 20:14:42 UTC 2010


Author: dukeleto
Date: Mon Oct  4 20:14:41 2010
New Revision: 49443
URL: https://trac.parrot.org/parrot/changeset/49443

Log:
[t] Add some basic tests for mk_language_shell.pl

Added:
   trunk/t/tools/mk_language_shell.t   (contents, props changed)
Modified:
   trunk/MANIFEST

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Mon Oct  4 20:02:31 2010	(r49442)
+++ trunk/MANIFEST	Mon Oct  4 20:14:41 2010	(r49443)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Oct  4 19:58:48 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Oct  4 20:12:34 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -2077,6 +2077,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/mk_language_shell.t                                 [test]
 t/tools/parrot_config.t                                     [test]
 t/tools/parrot_debugger.t                                   [test]
 t/tools/pbc_disassemble.t                                   [test]

Added: trunk/t/tools/mk_language_shell.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/t/tools/mk_language_shell.t	Mon Oct  4 20:14:41 2010	(r49443)
@@ -0,0 +1,87 @@
+#! perl
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/tools/mk_language_shell.t - test mk_language_shell.pl
+
+=head1 SYNOPSIS
+
+    % prove t/tools/mk_language_shell.t - test mk_language_shell.pl
+
+=head1 DESCRIPTION
+
+Tests the C<tools/dev/mk_language_shell.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 mk_language_shell.pl/ );
+    $exefile = $path . $PConfig{exe};
+    unless ( -f $exefile ) {
+        plan skip_all => "$exefile hasn't been built yet.";
+        exit(0);
+    }
+    plan tests => 5;
+}
+
+output_like(
+    "test_parrot_language_$$",
+     qr{creating test_parrot_language_},
+     'mk_language_shell basic sanity'
+);
+
+my $lang_dir = "test_parrot_language_$$";
+my $test_dir = catfile($lang_dir, "t");
+my $src_dir = catfile($lang_dir, "src");
+my $setup = catfile($lang_dir, "setup.pir");
+ok(-e $lang_dir, "$lang_dir dir exists");
+ok(-e $test_dir, "$test_dir dir exists");
+ok(-e $src_dir, "$src_dir dir exists");
+ok(-s $setup, "$setup exists and has nonzero size");
+
+
+=head1 HELPER SUBROUTINES
+
+=head2 output_like
+
+    output_like($keys, /regexp/, $description);
+
+Runs mk_language_shell with $keys as the argument and verifies the output.
+
+=cut
+
+sub 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