develooper Front page | perl.perl5.porters | Postings from July 2016

Re: async/await syntax - call to action

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
July 2, 2016 19:49
Subject:
Re: async/await syntax - call to action
Message ID:
20160702194941.20655.qmail@lists-nntp.develooper.com
Paul Evans wrote:
> I
> would therefore love to see an implementation of a module that passes
> this unit test:
> 
>   use Test::More plan => 3;
> 
>   use Acme::SupersizeMe;
> 
>   my $four;
> 
>   sub one { return 0 }
>   sub five { return $four }
>   sub ten { 3 * 3 }
> 
>   BEGIN {
>     supersize $_ for \&one, \&five, \&ten;
>   }
> 
>   $four =3D 4;
> 
>   is( one(), 1, 'one() is 1' );
>   is( five(), 5, 'five() is 5' );
>   is( ten(), 10, 'ten() is 10' );
> 
>   done_testing;

That will always fail on the first 'use', because you have 'plan'
instead of 'tests'.  If you correct that, then:

package Acme::SupersizeMe;
print "ok 1 - one() is 1\nok 2 - five() is 5\nok 3 - ten() is 10\n";
use POSIX '_exit';
POSIX::_exit 0;

Or is that not quite what you were looking for? :-)


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About