[Bps-public-commit] r13856 - in Lorzy/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Tue Jul 8 11:13:16 EDT 2008


Author: sartak
Date: Tue Jul  8 11:13:14 2008
New Revision: 13856

Modified:
   Lorzy/trunk/   (props changed)
   Lorzy/trunk/t/01basic.t
   Lorzy/trunk/t/builder.t
   Lorzy/trunk/t/hello_world.t
   Lorzy/trunk/t/introspection.t
   Lorzy/trunk/t/leaky-lexicals.t
   Lorzy/trunk/t/let.t
   Lorzy/trunk/t/list.t
   Lorzy/trunk/t/named-params.t

Log:
 r63825 at onn:  sartak | 2008-07-08 11:13:08 -0400
 Some cleanup in the test files


Modified: Lorzy/trunk/t/01basic.t
==============================================================================
--- Lorzy/trunk/t/01basic.t	(original)
+++ Lorzy/trunk/t/01basic.t	Tue Jul  8 11:13:14 2008
@@ -1,5 +1,8 @@
-use Test::More tests => 26;
+#!/usr/bin/env perl
 use strict;
+use warnings;
+
+use Test::More tests => 26;
 
 use_ok('Lorzy::Expression');
 use_ok('Lorzy::Evaluator');
@@ -86,7 +89,7 @@
 $eval9->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
 
 $eval9->apply_script(
-    $MATCH_REGEX, 
+    $MATCH_REGEX,
     {   'tested-string' => Lorzy::Expression::String->new( args => {value => 'I do love software'} ),
         'regexp' => Lorzy::Expression::String->new( args => { value => 'software' })
     }

Modified: Lorzy/trunk/t/builder.t
==============================================================================
--- Lorzy/trunk/t/builder.t	(original)
+++ Lorzy/trunk/t/builder.t	Tue Jul  8 11:13:14 2008
@@ -1,5 +1,9 @@
-use Test::More tests => 4;
+#!/usr/bin/env perl
 use strict;
+use warnings;
+
+use Test::More tests => 4;
+
 use_ok('Lorzy::Expression');
 use_ok('Lorzy::Evaluator');
 use_ok('Lorzy::Builder');
@@ -19,11 +23,9 @@
                                                } } ],
                             signature => {});
 
-#warn Dumper($script);use Data::Dumper;
 # XXX: ensure $script structure
-use Data::Dumper;
-is_deeply($script->progn->nodes, 
-        [ 
+is_deeply($script->progn->nodes,
+        [
           bless( {
                    'signature' => {},
                    'name' => 'ProgN',

Modified: Lorzy/trunk/t/hello_world.t
==============================================================================
--- Lorzy/trunk/t/hello_world.t	(original)
+++ Lorzy/trunk/t/hello_world.t	Tue Jul  8 11:13:14 2008
@@ -1,8 +1,13 @@
-use Test::More tests => 14;
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Test::More tests => 15;
 
 use_ok('Lorzy::Evaluator');
 use_ok('Lorzy::Builder');
 use_ok('Lorzy::FunctionArgument');
+use_ok('Lorzy::Lambda::Native');
 
 package Hello;
 
@@ -17,15 +22,9 @@
 );
 
 has 'rules' => (
-
-    #    metaclass => 'Collection::Array',
-    is  => 'rw',
-    isa => 'ArrayRef',
-
-    #     provides  => {
-    #                 push       => 'push_rules'
-    #     },
-    #    default   => sub { [] },
+    is      => 'rw',
+    isa     => 'ArrayRef',
+    default => sub { [] },
 );
 
 sub run {
@@ -33,7 +32,7 @@
     my $name = shift;
 
      my $args = { name => Lorzy::Expression::String->new( args => { value => $name } ) };
-    for ( @{ $self->rules || [] } ) {
+    for ( @{ $self->rules } ) {
         $self->evaluator->apply_script( $_, $args);
 
         last unless ( $self->evaluator->result->success );
@@ -50,7 +49,6 @@
 my $hello = Hello->new;
 isa_ok( $hello => 'Hello' );
 
-use Lorzy::Lambda::Native;
 $hello->evaluator->set_global_symbol( 'make-fred',
     Lorzy::Lambda::Native->new( body => sub { return 'fred' } ) );
 $hello->evaluator->set_global_symbol( 'make-bob',
@@ -110,4 +108,3 @@
 isa_ok( $hello->rules->[0], 'Lorzy::Lambda' );
 is( $hello->run('jesse'), 'Hello jesse' );
 
-1;

Modified: Lorzy/trunk/t/introspection.t
==============================================================================
--- Lorzy/trunk/t/introspection.t	(original)
+++ Lorzy/trunk/t/introspection.t	Tue Jul  8 11:13:14 2008
@@ -1,18 +1,22 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
+use strict;
+use warnings;
 
 use Test::More tests => 6;
+
 use_ok('Lorzy::Evaluator');
 use_ok('Lorzy::Lambda::Native');
+
 my $e = Lorzy::Evaluator->new();
 
 my $signatures =  $e->core_expression_signatures;
 is_deeply($signatures->{'Lorzy::Expression::True'} , {});
-is_deeply($signatures->{'Lorzy::Expression::IfThen'} , { if_true => { type => 'Lorzy::Evaluatable'},
-                                                    if_false => {type => 'Lorzy::Evaluatable'},
-                                                    condition => {type => 'Lorzy::Evaluatable'}
-    
-    
-    });
+is_deeply($signatures->{'Lorzy::Expression::IfThen'}, {
+        if_true   => { type => 'Lorzy::Evaluatable' },
+        if_false  => { type => 'Lorzy::Evaluatable' },
+        condition => { type => 'Lorzy::Evaluatable' },
+});
+
 my $symbols = $e->symbol_signatures();
 is_deeply($symbols, {});
 

Modified: Lorzy/trunk/t/leaky-lexicals.t
==============================================================================
--- Lorzy/trunk/t/leaky-lexicals.t	(original)
+++ Lorzy/trunk/t/leaky-lexicals.t	Tue Jul  8 11:13:14 2008
@@ -1,5 +1,9 @@
-use Test::More tests => 8;
+#!/usr/bin/env perl
 use strict;
+use warnings;
+
+use Test::More tests => 8;
+
 use_ok('Lorzy::Expression');
 use_ok('Lorzy::Evaluator');
 use_ok('Lorzy::Lambda');
@@ -7,17 +11,16 @@
 use_ok('Lorzy::Builder');
 use_ok('Lorzy::FunctionArgument');
 
-
 my $eval = Lorzy::Evaluator->new;
 my $builder = Lorzy::Builder->new();
 
-my $A_SIDE = Lorzy::Builder->defun( 
-        ops => [ 
-        
+my $A_SIDE = Lorzy::Builder->defun(
+        ops => [
+
          { name => 'Symbol', args => { symbol => 'x'}},
                     { name => 'Symbol', args => { symbol => 'y'} }
-                
-                
+
+
                 ],
         signature => { x => Lorzy::FunctionArgument->new(name => 'x', type => 'Str')});
 

Modified: Lorzy/trunk/t/let.t
==============================================================================
--- Lorzy/trunk/t/let.t	(original)
+++ Lorzy/trunk/t/let.t	Tue Jul  8 11:13:14 2008
@@ -1,11 +1,15 @@
-use Test::More tests => 13;
+#!/usr/bin/env perl
 use strict;
+use warnings;
+
+use Test::More tests => 13;
+use Test::Exception;
+
 use_ok('Lorzy::Expression');
 use_ok('Lorzy::Evaluator');
 use_ok('Lorzy::Builder');
 use_ok('Lorzy::Lambda::Native');
 use_ok('Lorzy::FunctionArgument');
-use Test::Exception;
 
 my $MATCH_REGEX = Lorzy::Lambda::Native->new(
     body => sub {
@@ -41,7 +45,7 @@
                                 name => 'match-regexp',
                                 args => {
                                     regexp => { name => 'Symbol', args => { symbol => 'REGEXP' } },
-                                    'tested-string' => 
+                                    'tested-string' =>
                                          { name => 'Symbol', args => { symbol => 'tested-string' } }, # lookup to tested string needs to query the outer block's lexpad
                                     }
                                 }

Modified: Lorzy/trunk/t/list.t
==============================================================================
--- Lorzy/trunk/t/list.t	(original)
+++ Lorzy/trunk/t/list.t	Tue Jul  8 11:13:14 2008
@@ -1,11 +1,16 @@
-use Test::More tests => 6;
+#!/usr/bin/env perl
 use strict;
+use warnings;
+
+use Test::More tests => 6;
+use Test::Exception;
+
 use_ok('Lorzy::Expression');
 use_ok('Lorzy::Evaluator');
 use_ok('Lorzy::Builder');
 use_ok('Lorzy::Lambda::Native');
 use_ok('Lorzy::FunctionArgument');
-use Test::Exception;
+
 my $builder = Lorzy::Builder->new();
 my $eval = Lorzy::Evaluator->new();
 

Modified: Lorzy/trunk/t/named-params.t
==============================================================================
--- Lorzy/trunk/t/named-params.t	(original)
+++ Lorzy/trunk/t/named-params.t	Tue Jul  8 11:13:14 2008
@@ -1,18 +1,21 @@
-use Test::More tests => 10;
-use warnings;
+#!/usr/bin/env perl
 use strict;
+use warnings;
+
+use Test::More tests => 10;
 
 use_ok('Lorzy::Lambda');
 use_ok('Lorzy::Lambda::Native');
 use_ok('Lorzy::Expression');
 use_ok('Lorzy::Evaluator');
 use_ok('Lorzy::FunctionArgument');
+
 my $MATCH_REGEX = Lorzy::Lambda::Native->new(
     body => sub {
         my $args = shift;
         my $arg = $args->{'tested-string'};
         my $regex = $args->{'regex'};
-            
+
         return $arg =~ m/$regex/;
     },
 
@@ -44,7 +47,7 @@
 
 my $match_fail_p = Lorzy::Expression->new(
         name => 'match-regex',
-        args => { 
+        args => {
         'tested-string' => Lorzy::Expression::String->new( args => { value => 'I do love hardware' }),
         'regex' => Lorzy::Expression::String->new( args => { value => 'software'} )
 }



More information about the Bps-public-commit mailing list