[Bps-public-commit] r18830 - Lorzy/trunk/t

clkao at bestpractical.com clkao at bestpractical.com
Wed Mar 18 10:00:23 EDT 2009


Author: clkao
Date: Wed Mar 18 10:00:22 2009
New Revision: 18830

Modified:
   Lorzy/trunk/t/roundtrip.t

Log:
failing test for roundtriping lambda.

Modified: Lorzy/trunk/t/roundtrip.t
==============================================================================
--- Lorzy/trunk/t/roundtrip.t	(original)
+++ Lorzy/trunk/t/roundtrip.t	Wed Mar 18 10:00:22 2009
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 7;
+use Test::More tests => 11;
 use Test::Exception;
 use_ok('Lorzy::Expression');
 use_ok('Lorzy::Evaluator');
@@ -27,7 +27,7 @@
                          ],
                                                } } ],
                             signature => { something => 
-                                               Lorzy::FunctionArgument->new( name => 'tested-string')});
+                                               Lorzy::FunctionArgument->new( name => 'something')});
 
 isa_ok($script, "Lorzy::Lambda");
 my $ret;
@@ -36,6 +36,33 @@
 };
 is($ret, 'world');
 
+my $script2 = $builder->defun(
+                             ops => [
+                                     { name => 'ProgN',
+                                       args => {
+                                                nodes => [
+                                                          { name => 'Native.Apply', args => 
+                                                            { code => { name => 'Symbol', args => { symbol => 'code' } },
+                                                              args => { name => 'List', nodes => [ 'orz' ] },
+                                                                                     } },
+                         ],
+                                               } } ],
+                            signature => { code => 
+                                               Lorzy::FunctionArgument->new( name => 'code')});
+
+isa_ok($script2, "Lorzy::Lambda");
+my $called=0;
+my $code = sub {
+    ++$called;
+    return 'roundtrip: '.join(',', at _);
+};
+
+lives_ok {
+    $ret = $eval->apply_script( $script2, { 'code' => $code } );
+};
+ok($called);
+is($ret, 'roundtrip: orz');
+
 package TestClass;
 
 sub hello {



More information about the Bps-public-commit mailing list