[Bps-public-commit] r12642 - pie/branches/named-params/t

jesse at bestpractical.com jesse at bestpractical.com
Fri May 23 08:36:06 EDT 2008


Author: jesse
Date: Fri May 23 08:36:06 2008
New Revision: 12642

Added:
   pie/branches/named-params/t/leaky-lexicals.t

Log:
basic tests for leaking lexicals after exiting a script apply

Added: pie/branches/named-params/t/leaky-lexicals.t
==============================================================================
--- (empty file)
+++ pie/branches/named-params/t/leaky-lexicals.t	Fri May 23 08:36:06 2008
@@ -0,0 +1,28 @@
+use Test::More tests => 6;
+
+use_ok('PIE::Evaluator');
+use_ok('PIE::Builder');
+use_ok('PIE::FunctionArgument');
+use_ok('PIE::Lambda::Native');
+my $evaluator = PIE::Evaluator->new();
+$evaluator->set_named( 'make-fred', PIE::Lambda::Native->new( body => sub { return 'fred' } ) );
+$evaluator->set_named( 'make-bob', PIE::Lambda::Native->new( body => sub { return 'bob' } ) );
+
+my $args = { name => PIE::Expression::String->new( args => { value => 'Hiro' } ) };
+
+
+
+
+
+
+my $builder = PIE::Builder->new();
+
+my $script3 = $builder->defun( ops => [ { name => 'make-bob' } ],
+    signature => { name => PIE::FunctionArgument->new( name => 'name', type => 'Str' ) }
+);
+my %before = %{ $evaluator->named};
+$evaluator->apply_script( $script3, $args);
+my %after = %{ $evaluator->named};
+is($evaluator->result->value,'bob');
+is_deeply(\%before => \%after);
+



More information about the Bps-public-commit mailing list