Author: bernhard
Date: Sat May 12 05:19:34 2007
New Revision: 18515

Added:
   trunk/languages/lisp/lib/
   trunk/languages/lisp/lib/Parrot/
   trunk/languages/lisp/lib/Parrot/Test/
   trunk/languages/lisp/lib/Parrot/Test/Lisp.pm   (contents, props changed)
   trunk/languages/lisp/t/harness   (contents, props changed)
   trunk/languages/lisp/t/hello.t   (contents, props changed)
Removed:
   trunk/languages/lisp/t/test.l
Modified:
   trunk/MANIFEST
   trunk/MANIFEST.SKIP
   trunk/languages/lisp/config/makefiles/root.in
   trunk/languages/lisp/t/   (props changed)

Log:
#42885: Resurrect languages/lisp
Add a t/harness and a 'Hello World' test.
Add Parrot::Test::Lisp
Add the 'test' Makefile target.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Sat May 12 05:19:34 2007
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri May 11 18:46:27 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat May 12 12:03:02 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -1400,6 +1400,7 @@
 languages/lisp/include/macros/standard.pir                  [lisp]
 languages/lisp/include/macros/types.pir                     [lisp]
 languages/lisp/internals.pir                                [lisp]
+languages/lisp/lib/Parrot/Test/Lisp.pm                      [lisp]
 languages/lisp/lisp.pir                                     [lisp]
 languages/lisp/lisp/bootstrap.l                             [lisp]
 languages/lisp/lisp/core.l                                  [lisp]
@@ -1410,7 +1411,8 @@
 languages/lisp/lisp/pred.l                                  [lisp]
 languages/lisp/read.pir                                     [lisp]
 languages/lisp/system.pir                                   [lisp]
-languages/lisp/t/test.l                                     [lisp]
+languages/lisp/t/harness                                    [lisp]
+languages/lisp/t/hello.t                                    [lisp]
 languages/lisp/types.pir                                    [lisp]
 languages/lisp/validate.pir                                 [lisp]
 languages/lua/Lua/build.pm                                  [lua]

Modified: trunk/MANIFEST.SKIP
==============================================================================
--- trunk/MANIFEST.SKIP (original)
+++ trunk/MANIFEST.SKIP Sat May 12 05:19:34 2007
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Fri May 11 00:51:09 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat May 12 12:03:02 2007 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
@@ -803,6 +803,11 @@
 ^languages/lisp/Makefile/
 ^languages/lisp/lisp\.pbc$
 ^languages/lisp/lisp\.pbc/
+# generated from svn:ignore of 'languages/lisp/t/'
+^languages/lisp/t/.*\.l$
+^languages/lisp/t/.*\.l/
+^languages/lisp/t/.*\.out$
+^languages/lisp/t/.*\.out/
 # generated from svn:ignore of 'languages/lua/'
 ^languages/lua/Makefile$
 ^languages/lua/Makefile/

Modified: trunk/languages/lisp/config/makefiles/root.in
==============================================================================
--- trunk/languages/lisp/config/makefiles/root.in       (original)
+++ trunk/languages/lisp/config/makefiles/root.in       Sat May 12 05:19:34 2007
@@ -1,3 +1,6 @@
+# $Id$
+
+# Setup some commands
 RM_F = @rm_f@
 PERL = @perl@
 PARROT = ../../[EMAIL PROTECTED]@
@@ -5,13 +8,16 @@
 all: build
 
 test: build
-       $(PARROT) -r lisp.pbc t/test.l
+       $(PERL) -Ilib -I../../lib t/harness
 
 build: lisp.pir
        $(PARROT) -o lisp.pbc lisp.pir
 
-clean:
+clean: testclean
        $(RM_F) core "*.pbc" "*~"
 
+testclean:
+       $(RM_F) t/*.out t/*.l
+
 realclean: clean
        $(RM_F) Makefile

Added: trunk/languages/lisp/lib/Parrot/Test/Lisp.pm
==============================================================================
--- (empty file)
+++ trunk/languages/lisp/lib/Parrot/Test/Lisp.pm        Sat May 12 05:19:34 2007
@@ -0,0 +1,66 @@
+# $Id$
+
+package Parrot::Test::Lisp;
+
+use strict;
+use warnings;
+
+use File::Basename;
+
+=head1 NAME
+
+Parrot::Test::Lisp -- testing routines for languages/lisp
+
+This is largely a copy of Parrot::Test::Punie.
+
+=cut
+
+sub new {
+    return bless {};
+}
+
+sub output_is {
+    my ( $self, $code, $output, $desc ) = @_;
+
+    my $count = $self->{builder}->current_test + 1;
+
+    my $lang_f = Parrot::Test::per_test( '.l',  $count );
+    my $out_f  = Parrot::Test::per_test( '.out', $count );
+    my $parrotdir = dirname $self->{parrot};
+
+    my $args = $ENV{TEST_PROG_ARGS} || '';
+
+    $lang_f = File::Spec->rel2abs($lang_f);
+    $out_f  = File::Spec->rel2abs($out_f);
+    Parrot::Test::write_code_to_file( $code, $lang_f );
+
+    my $cmd;
+    my $exit_code = 0;
+    my $pass      = 0;
+
+    $cmd = "$self->{parrot} $args languages/lisp/lisp.pbc $lang_f";
+
+    $exit_code = Parrot::Test::run_command(
+        $cmd,
+        CD     => $self->{relpath},
+        STDOUT => $out_f,
+        STDERR => $out_f
+    );
+    unless ($pass) {
+        my $file = Parrot::Test::slurp_file($out_f);
+        $pass = $self->{builder}->is_eq( Parrot::Test::slurp_file($out_f), 
$output, $desc );
+        $self->{builder}->diag("'$cmd' failed with exit code $exit_code")
+            if $exit_code and not $pass;
+    }
+
+    return $pass;
+}
+
+1;
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/languages/lisp/t/harness
==============================================================================
--- (empty file)
+++ trunk/languages/lisp/t/harness      Sat May 12 05:19:34 2007
@@ -0,0 +1,10 @@
+#! perl
+
+# $Id$
+
+use strict;
+use warnings;
+
+use lib 'lib', '../../lib';
+
+use Parrot::Test::Harness language => 'lisp';

Added: trunk/languages/lisp/t/hello.t
==============================================================================
--- (empty file)
+++ trunk/languages/lisp/t/hello.t      Sat May 12 05:19:34 2007
@@ -0,0 +1,28 @@
+# $Id$
+
+=head1 NAME
+
+lisp/t/hello.t - tests for Parrot Common Lisp
+
+=head1 DESCRIPTION
+
+A couple of 'Hello World' tests.
+
+=cut
+
+# pragmata
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../../lib";
+
+# core Perl modules
+use Test::More     tests => 1;
+
+# Parrot modules
+use Parrot::Test;
+
+language_output_is( 'Lisp', <<'END_CODE', 'Hello, World!', 'hello 1' );
+( print "Hello, World!" )
+END_CODE

Reply via email to