Author: bernhard Date: Sat Jan 24 13:21:39 2009 New Revision: 35966 Added: trunk/languages/unlambda/examples/k.unl (contents, props changed) - copied, changed from r35961, /trunk/languages/unlambda/examples/h.unl Modified: trunk/MANIFEST trunk/languages/unlambda/t/examples.t
Log: [unlambda] add example with the "k" function Modified: trunk/MANIFEST ============================================================================== --- trunk/MANIFEST (original) +++ trunk/MANIFEST Sat Jan 24 13:21:39 2009 @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Sat Jan 24 20:18:58 2009 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sat Jan 24 21:14:32 2009 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -2482,6 +2482,7 @@ languages/unlambda/config/makefiles/root.in [unlambda] languages/unlambda/examples/h.unl [unlambda] languages/unlambda/examples/hello.unl [unlambda] +languages/unlambda/examples/k.unl [unlambda] languages/unlambda/examples/newline.unl [unlambda] languages/unlambda/t/examples.t [unlambda] languages/unlambda/t/harness [unlambda] Copied: trunk/languages/unlambda/examples/k.unl (from r35961, /trunk/languages/unlambda/examples/h.unl) ============================================================================== --- /trunk/languages/unlambda/examples/h.unl (original) +++ trunk/languages/unlambda/examples/k.unl Sat Jan 24 13:21:39 2009 @@ -1,4 +1,8 @@ -# print the character 'h' and a newline -# .hi prints h as a sideeffect, i is a dummy argument -# r prints a newline -`r`.hi +# This program demonstrates the "k" function +# +# The character 'H' is printed. +# +# ".Hi" prints 'H' as a sideeffect, "i" is a dummy argument. +# "k" is the identity function, which returns it's first argument, ".hi". +# The last "i" is the second argument to "k". +```k.Hii Modified: trunk/languages/unlambda/t/examples.t ============================================================================== --- trunk/languages/unlambda/t/examples.t (original) +++ trunk/languages/unlambda/t/examples.t Sat Jan 24 13:21:39 2009 @@ -1,6 +1,6 @@ #! perl -# Copyright (C) 2005-2008, The Perl Foundation. +# Copyright (C) 2005-2009, The Perl Foundation. # $Id$ =head1 NAME @@ -9,9 +9,7 @@ =head1 SYNOPSIS - % cd languages && perl unlambda/t/examples.t - - % cd languages/unlambda && perl t/examples.t + % cd languages/unlambda && perl t/examples.t =head1 DESCRIPTION @@ -28,8 +26,8 @@ use FindBin; use lib "$FindBin::Bin/../../../lib"; -use Test::More tests => 3; -use Parrot::Config; +use Test::More tests => 4; +use Parrot::Config qw(%PConfig); use File::Spec (); my $parrot = File::Spec->catfile( $FindBin::Bin, @@ -41,15 +39,16 @@ File::Spec->updir(), 'unl.pir' ); my %expected = ( - newline => "\n", - h => "h\n", - hello => "Hello world\n", + 'newline.unl' => "\n", + 'h.unl' => "h\n", + 'hello.unl' => "Hello world\n", + 'k.unl' => 'H', ); -while ( my ( $example, $out ) = each %expected ) { +while ( my ($code_fn, $out) = each %expected ) { my $prog = File::Spec->catfile( $FindBin::Bin, File::Spec->updir(), 'examples', - "$example.unl" ); - is( `$unlamba $prog`, $out, "example $example" ); + $code_fn ); + is( `$unlamba $prog`, $out, "example $code_fn" ); }