develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35994 - in trunk: . languages/lazy-k/t languages/t

From:
bernhard
Date:
January 25, 2009 04:01
Subject:
[svn:parrot] r35994 - in trunk: . languages/lazy-k/t languages/t
Message ID:
20090125120139.5355ACB9AE@x12.develooper.com
Author: bernhard
Date: Sun Jan 25 04:01:37 2009
New Revision: 35994

Added:
   trunk/languages/lazy-k/t/examples.t   (contents, props changed)
      - copied, changed from r35992, /trunk/languages/lazy-k/t/calc.t
Removed:
   trunk/languages/lazy-k/t/calc.t
   trunk/languages/lazy-k/t/cat.t
Modified:
   trunk/MANIFEST
   trunk/languages/t/harness

Log:
[lazy-k] Merge t/calc.t and t/cat.t into t/examples.t.
Bring lazy-k back into unified languages testing.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Sun Jan 25 04:01:37 2009
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Jan 25 11:38:41 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Jan 25 11:59:35 2009 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -1621,8 +1621,7 @@
 languages/lazy-k/examples/cat.lazy                          []
 languages/lazy-k/examples/powers2.lazy                      []
 languages/lazy-k/lazy.pir                                   []
-languages/lazy-k/t/calc.t                                   []
-languages/lazy-k/t/cat.t                                    []
+languages/lazy-k/t/examples.t                               []
 languages/lazy-k/t/harness                                  []
 languages/lisp/CHANGES                                      [lisp]
 languages/lisp/KNOWN_BUGS                                   [lisp]

Copied: trunk/languages/lazy-k/t/examples.t (from r35992, /trunk/languages/lazy-k/t/calc.t)
==============================================================================
--- /trunk/languages/lazy-k/t/calc.t	(original)
+++ trunk/languages/lazy-k/t/examples.t	Sun Jan 25 04:01:37 2009
@@ -3,15 +3,16 @@
 
 =head1 NAME
 
-t/calc.t - testing calc.lazy
+t/examples.t - testing the lazy-l code examples
 
 =head1 SYNOPSIS
 
-    % cd languages/lazy-k && perl lazy-k/t/calc.t
+    % cd languages/lazy-k && perl t/examples.t
 
 =head1 DESCRIPTION
 
-Test calc.lazy.
+Test calc.lazy and cat.lazy.
+powers.lazy is not tested, as the output is infinite.
 
 =head1 AUTHOR
 
@@ -24,24 +25,35 @@
 use FindBin;
 use lib "$FindBin::Bin/../../../lib";
 
-use Test::More       tests => 1;
+use Test::More       tests => 2;
 use Parrot::Config   qw(%PConfig);
 use File::Spec       ();
 
 my $is_win32  = $^O eq 'MSWin32';
-
-my $parrot    = File::Spec->catfile( File::Spec->updir(), File::Spec->updir(), $PConfig{test_prog} );
-my $lazy_k    = "$parrot lazy.pbc";
+my $parrot    = File::Spec->catfile( $FindBin::Bin,
+                                     File::Spec->updir(),
+                                     File::Spec->updir(),
+                                     File::Spec->updir(),
+                                     $PConfig{test_prog} );
+my $lazy_k    = $parrot . q{ } . File::Spec->catfile( $FindBin::Bin,
+                                                      File::Spec->updir(), 
+                                                      'lazy.pbc' );
 my $source_fn = 'examples/calc.lazy'; 
-
-# XXX This does not look portable.
-my $cmd;
-if ($is_win32) {
+my @test_cases = (
+    [ 'calc.lazy', '2*4+3', "11\n" ],
+    [ 'cat.lazy',  '2*4+3', "2*4+3\n" ],
+);
+
+foreach (@test_cases) {
+    my ($code_fn, $in, $out) = @{$_};
+
+    my $code_path = File::Spec->catfile( $FindBin::Bin,
+                                         File::Spec->updir(),
+                                         'examples',
+                                         $code_fn ); 
+    # XXX This does not look portable.
     # Don't quote the string on Windows, it is passed on literally
-    $cmd = qq{echo 1+2*3 | $lazy_k $source_fn};
+    my $cmd = $is_win32 ? qq{echo $in | $lazy_k $code_path}
+                        : qq{echo '$in' | $lazy_k $code_path};
+    is( `$cmd`, $out, "$code_fn $in" );
 }
-else {
-    $cmd = qq{echo '1+2*3' | $lazy_k $source_fn};
-}
-
-is( `$cmd`, "7\n", 'calc.lazy' );

Modified: trunk/languages/t/harness
==============================================================================
--- trunk/languages/t/harness	(original)
+++ trunk/languages/t/harness	Sun Jan 25 04:01:37 2009
@@ -69,7 +69,6 @@
 # BASIC                No t/harness, two implementations
 # ecmascript           No t/harness
 # forth                No t/harness
-# lazy-k               path dependencies in test scripts
 # perl6                test scripts are written in Perl 6, not Perl 5
 # pheme                test scripts are written in Scheme, not Perl 5
 # PIR                  many test failures
@@ -87,7 +86,7 @@
               cola
               dotnet
               jako
-              lisp lua
+              lazy-k lisp lua
               ook
               parrot_compiler pipp punie
               regex



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About