[tapx-dev] [commit][174] Tidied

andy at hexten.net andy at hexten.net
Thu Jul 12 23:37:30 BST 2007


Revision: 174
Author:   andy
Date:     2007-07-12 23:37:29 +0100 (Thu, 12 Jul 2007)

Log Message:
-----------
Tidied

Modified Paths:
--------------
    trunk/t/030-grammar.t

Modified: trunk/t/030-grammar.t
===================================================================
--- trunk/t/030-grammar.t	2007-07-12 15:36:13 UTC (rev 173)
+++ trunk/t/030-grammar.t	2007-07-12 22:37:29 UTC (rev 174)
@@ -32,7 +32,7 @@
 
 my $stream = SS->new;
 can_ok $GRAMMAR, 'new';
-ok my $grammar = $GRAMMAR->new($stream), '... and calling it should succeed';
+ok my $grammar = $GRAMMAR->new( $stream ), '... and calling it should succeed';
 isa_ok $grammar, $GRAMMAR, '... and the object it returns';
 
 # Note:  all methods are actually class methods.  See the docs for the reason
@@ -45,26 +45,24 @@
 can_ok $grammar, 'token_types';
 ok my @types = sort( $grammar->token_types ),
   '... and calling it should succeed (v12)';
-is_deeply \@types, \@V12,
-  '... and return the correct token types (v12)';
-  
-$grammar->set_version(13);  
+is_deeply \@types, \@V12, '... and return the correct token types (v12)';
+
+$grammar->set_version( 13 );
 ok @types = sort( $grammar->token_types ),
   '... and calling it should succeed (v13)';
-is_deeply \@types, \@V13,
-  '... and return the correct token types (v13)';
+is_deeply \@types, \@V13, '... and return the correct token types (v13)';
 
 can_ok $grammar, 'syntax_for';
 can_ok $grammar, 'handler_for';
 
 my ( %syntax_for, %handler_for );
-foreach my $type (@types) {
-    ok $syntax_for{$type} = $grammar->syntax_for($type),
+foreach my $type ( @types ) {
+    ok $syntax_for{$type} = $grammar->syntax_for( $type ),
       '... and calling syntax_for() with a type name should succeed';
     cmp_ok ref $syntax_for{$type}, 'eq', 'Regexp',
       '... and it should return a regex';
 
-    ok $handler_for{$type} = $grammar->handler_for($type),
+    ok $handler_for{$type} = $grammar->handler_for( $type ),
       '... and calling handler_for() with a type name should succeed';
     cmp_ok ref $handler_for{$type}, 'eq', 'CODE',
       '... and it should return a code reference';
@@ -76,7 +74,7 @@
 
 my $method = $handler_for{'plan'};
 $plan =~ $syntax_for{'plan'};
-ok my $plan_token = $grammar->$method($plan),
+ok my $plan_token = $grammar->$method( $plan ),
   '... and the handler should return a token';
 
 my $expected = {
@@ -86,11 +84,10 @@
     'tests_planned' => 1,
     'raw'           => '1..1'
 };
-is_deeply $plan_token, $expected,
-  '... and it should contain the correct data';
+is_deeply $plan_token, $expected, '... and it should contain the correct data';
 
 can_ok $grammar, 'tokenize';
-$stream->put($plan);
+$stream->put( $plan );
 ok my $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 is_deeply $token, $expected,
@@ -101,7 +98,7 @@
 $plan = '1..0 # SKIP why not?';
 like $plan, $syntax_for{'plan'}, 'a basic plan should match its syntax';
 
-ok $plan_token = $grammar->$method($plan),
+ok $plan_token = $grammar->$method( $plan ),
   '... and the handler should return a token';
 
 $expected = {
@@ -111,10 +108,9 @@
     'tests_planned' => 0,
     'raw'           => '1..0 # SKIP why not?'
 };
-is_deeply $plan_token, $expected,
-  '... and it should contain the correct data';
+is_deeply $plan_token, $expected, '... and it should contain the correct data';
 
-$stream->put($plan);
+$stream->put( $plan );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 is_deeply $token, $expected,
@@ -126,7 +122,7 @@
 like $plan, $syntax_for{'plan'},
   'A plan  with an implied "skip all" should match its syntax';
 
-ok $plan_token = $grammar->$method($plan),
+ok $plan_token = $grammar->$method( $plan ),
   '... and the handler should return a token';
 
 $expected = {
@@ -136,10 +132,9 @@
     'tests_planned' => 0,
     'raw'           => '1..0'
 };
-is_deeply $plan_token, $expected,
-  '... and it should contain the correct data';
+is_deeply $plan_token, $expected, '... and it should contain the correct data';
 
-$stream->put($plan);
+$stream->put( $plan );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 is_deeply $token, $expected,
@@ -148,8 +143,7 @@
 # bad plan
 
 $plan = '1..0 # TODO 3,4,5';    # old syntax.  No longer supported
-unlike $plan, $syntax_for{'plan'},
-  'Bad plans should not match the plan syntax';
+unlike $plan, $syntax_for{'plan'}, 'Bad plans should not match the plan syntax';
 
 # Bail out!
 
@@ -157,7 +151,7 @@
 like $bailout, $syntax_for{'bailout'},
   'Bail out! should match a bailout syntax';
 
-$stream->put($bailout);
+$stream->put( $bailout );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 $expected = {
@@ -172,7 +166,7 @@
 like $bailout, $syntax_for{'bailout'},
   'Bail out! should match a bailout syntax';
 
-$stream->put($bailout);
+$stream->put( $bailout );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 $expected = {
@@ -189,7 +183,7 @@
 like $comment, $syntax_for{'comment'},
   'Comments should match the comment syntax';
 
-$stream->put($comment);
+$stream->put( $comment );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 $expected = {
@@ -205,7 +199,7 @@
 my $test = 'ok 1 this is a test';
 like $test, $syntax_for{'test'}, 'Tests should match the test syntax';
 
-$stream->put($test);
+$stream->put( $test );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 
@@ -226,7 +220,7 @@
 $test = 'not ok 2 this is a test # TODO whee!';
 like $test, $syntax_for{'test'}, 'Tests should match the test syntax';
 
-$stream->put($test);
+$stream->put( $test );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 
@@ -240,6 +234,7 @@
     'raw'         => 'not ok 2 this is a test # TODO whee!'
 };
 is_deeply $token, $expected,
+'... and the TODO should be parsed';
 
   # false TODO tests
 
@@ -247,7 +242,7 @@
   $test = 'ok 22 this is a test \# TODO whee!';
 like $test, $syntax_for{'test'}, 'Tests should match the test syntax';
 
-$stream->put($test);
+$stream->put( $test );
 ok $token = $grammar->tokenize,
   '... and calling it with data should return a token';
 




More information about the tapx-dev mailing list