On Jan 9, 2008 10:36 PM, via RT Mark Grimes
<[EMAIL PROTECTED]> wrote:
> # New Ticket Created by  Mark Grimes
> # Please include the string:  [perl #49596]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=49596 >
>
>
> Hi all,
>
> The attached patch is an attempt at converting t/pmc/eventhandler.t from
> perl to parrot (as outlined in the parrot wiki). This is a pretty minor
> patch, but I wanted to make sure I was heading down the right path
> before working through a bunch of them.
>
> This is my first stab at PIR, so suggestions/critisism/etc is very
> welcome.

Looks good, thanks! A few minor minor nits which are just book-keeping tasks:

- update the copyright notice from 2007 to 2007-2008
- update the coda at the bottom: it's still claiming to be perl code
(just find a .pir file that already has the comment and copy it from
there.)

Otherwise, looks good. (drops the runtime for this test from about .1s
 to about 0.04s)

> Thanks,
> Mark
>
> [EMAIL PROTECTED]
>
>
> Index: t/pmc/eventhandler.t
> ===================================================================
> --- t/pmc/eventhandler.t        (revision 24707)
> +++ t/pmc/eventhandler.t        (working copy)
> @@ -1,13 +1,7 @@
> -#! perl
> +#! parrot
>  # Copyright (C) 2007, The Perl Foundation.
>  # $Id $
>
> -use strict;
> -use warnings;
> -use lib qw( . lib ../lib ../../lib );
> -use Test::More;
> -use Parrot::Test tests => 1;
> -
>  =head1 NAME
>
>  t/pmc/eventhandler.t - Parrot Event Handling
> @@ -22,12 +16,19 @@
>
>  =cut
>
> -pir_output_is( <<'CODE', <<'OUT', "create an event and set attributes" );
> -  .sub main :main
> +.sub main :main
> +    .include 'include/test_more.pir'
> +
> +    plan(4)
> +
> +    create_an_event_and_set_attributes()
> +.end
> +
> +.sub create_an_event_and_set_attributes
>      .local pmc eh
>      eh  = new 'EventHandler'
>      $S0 = typeof eh
> -    say $S0
> +    is( $S0, 'EventHandler', 'Created EventHandler' )
>
>      .local pmc init
>      init = new 'Hash'
> @@ -48,32 +49,28 @@
>
>      eh  = new 'EventHandler', init
>      $S0 = typeof eh
> -    say $S0
> +    is( $S0, 'EventHandler', 'Created EventHandler with args' )
>
>      $S1 = eh
> -    say $S1
> +    is( $S1, 'cool event', 'Event type confirmed' )
>
>      push_eh bad_args
>          eh = new 'EventHandler', code
>      pop_eh
>
> -    say "All clear!"
> +    ok( 1, 'No exception from initializer' )
>      end
>
>    bad_args:
> -    say "No exception with bad initializer"
> +    ok( 0, 'Exception with bad initializer' )
>      end
> -  .end
>
> -  .sub my_handler
> -  .end
> -CODE
> -EventHandler
> -EventHandler
> -cool event
> -All clear!
> -OUT
> +.end
>
> +.sub my_handler
> +.end
> +
> +
>  # Local Variables:
>  #   mode: cperl
>  #   cperl-indent-level: 4
>
>



-- 
Will "Coke" Coleda

Reply via email to