Skip to content

Commit

Permalink
Normalize the #! lines.
Browse files Browse the repository at this point in the history
Destroy all tabs.
  • Loading branch information
schwern committed Jun 2, 2009
1 parent a227c02 commit 0b8a354
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 49 deletions.
2 changes: 1 addition & 1 deletion t/CLASS.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!perl

use Test::More 'no_plan';
use perl5i;
Expand Down
2 changes: 1 addition & 1 deletion t/File-stat.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!perl

use perl5i;
use Test::More 'no_plan';
Expand Down
2 changes: 1 addition & 1 deletion t/Module-Load.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!perl

use perl5i;
use Test::More 'no_plan';
Expand Down
2 changes: 1 addition & 1 deletion t/autobox.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!perl -w

use perl5i;
use Test::More 'no_plan';
Expand Down
2 changes: 1 addition & 1 deletion t/autobox_array_dump.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!perl -w

use perl5i;
use Test::More tests => 3;
Expand Down
2 changes: 1 addition & 1 deletion t/autobox_hash_dump.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!perl -w

use perl5i;
use Test::More tests => 3;
Expand Down
2 changes: 1 addition & 1 deletion t/autobox_scalar_dump.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!perl -w

use perl5i;
use Test::More tests => 4;
Expand Down
2 changes: 1 addition & 1 deletion t/autodie.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!perl

use perl5i;
use Test::More "no_plan";
Expand Down
2 changes: 1 addition & 1 deletion t/datetime.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!perl -w

use perl5i;

Expand Down
23 changes: 14 additions & 9 deletions t/first.t
@@ -1,3 +1,5 @@
#!perl

use perl5i;

use Test::More tests => 13;
Expand All @@ -13,7 +15,7 @@ $v = []->first( sub { 0 } );
is($v, undef, 'no args');

$v = [[qw(a b c)], [qw(d e f)], [qw(g h i)]]->first(
sub { $_->[1] le "e" and "e" le $_->[2] }
sub { $_->[1] le "e" and "e" le $_->[2] }
);
is_deeply($v, [qw(d e f)], 'reference args');

Expand All @@ -26,7 +28,7 @@ $v = eval { [0,0,1]->first( sub { die if $_ } ) };
is($v, undef, 'use of die');

sub foobar {
["not ","not ","not "]->first( sub { !defined(wantarray) || wantarray } )
["not ","not ","not "]->first( sub { !defined(wantarray) || wantarray } )
}

($v) = foobar();
Expand All @@ -42,9 +44,9 @@ is($v, 12, 'return from loop');

# Does it work from another package?
{
package Foo;
use autobox::List::Util;
::is( [1..4,24]->first(sub{$_>4}), 24, 'other package');
package Foo;
use autobox::List::Util;
::is( [1..4,24]->first(sub{$_>4}), 24, 'other package');
}

# Can we undefine a first sub while it's running?
Expand All @@ -57,10 +59,13 @@ like($@, qr/^Can't undef active subroutine/, "undef active sub");
# running the Perl or XS implementation.

{
local $SIG{__WARN__} = sub {}; #trap warnings;
sub self_updating { local $^W; *self_updating = sub{1} ;1}
eval { $v = [1,2]->first(\&self_updating) };
is($@, '', 'redefine self');
sub self_updating {
no warnings 'redefine';
*self_updating = sub{1};
return;
}
eval { $v = [1,2]->first(\&self_updating) };
is($@, '', 'redefine self');
}

{ my $failed = 0;
Expand Down
2 changes: 1 addition & 1 deletion t/lexical.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!perl -w

# perl5i should have lexical effect, ideally

Expand Down
2 changes: 2 additions & 0 deletions t/max.t
@@ -1,3 +1,5 @@
#!perl

use perl5i;

use Test::More tests => 4;
Expand Down
2 changes: 2 additions & 0 deletions t/maxstr.t
@@ -1,3 +1,5 @@
#!perl

use perl5i;

use Test::More tests => 4;
Expand Down
2 changes: 2 additions & 0 deletions t/min.t
@@ -1,3 +1,5 @@
#!perl

use perl5i;

use Test::More tests => 4;
Expand Down
2 changes: 2 additions & 0 deletions t/minstr.t
@@ -1,3 +1,5 @@
#!perl

use perl5i;

use Test::More tests => 4;
Expand Down
2 changes: 1 addition & 1 deletion t/modern_perl.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!perl

# Test the basic Modern::Perl functionality works.

Expand Down
42 changes: 22 additions & 20 deletions t/reduce.t
@@ -1,51 +1,53 @@
#!perl

use perl5i;

use Test::More tests => 20;

my $v = []->reduce(sub {});

is( $v, undef, 'no args');
is( $v, undef, 'no args');

$v = [756,3,7,4]->reduce(sub { $a / $b });
is( $v, 9, '4-arg divide');
is( $v, 9, '4-arg divide');

$v = [6]->reduce( sub { $a / $b } );
is( $v, 6, 'one arg');
is( $v, 6, 'one arg');

my @a = map { rand } 0 .. 20;
$v = @a->reduce( sub { $a < $b ? $a : $b });
is( $v, @a->min, 'min');
is( $v, @a->min, 'min');

@a = map { pack("C", int(rand(256))) } 0 .. 20;
$v = @a->reduce( sub { $a . $b } );
is( $v, join("",@a), 'concat');
is( $v, join("",@a), 'concat');

sub add {
my($aa, $bb) = @_;
return $aa + $bb;
}

$v = [3, 2, 1]->reduce( sub { my $t="$a $b\n"; 0+add($a, $b) } );
is( $v, 6, 'call sub');
is( $v, 6, 'call sub');

# Check that eval{} inside the block works correctly
$v = [0,1,2,3,4]->reduce( sub { eval { die }; $a + $b } );
is( $v, 10, 'use eval{}');
is( $v, 10, 'use eval{}');

$v = !defined eval { [0..4]->reduce( sub { die if $b > 2; $a + $b } ) };
ok($v, 'die');

sub foobar { [0..3]->reduce( sub { (defined(wantarray) && !wantarray) ? $a+1 : 0 } ) }
($v) = foobar();
is( $v, 3, 'scalar context');
is( $v, 3, 'scalar context');

sub add2 { $a + $b }

$v = [1,2,3]->reduce(\&add2);
is( $v, 6, 'sub reference');
is( $v, 6, 'sub reference');

$v = [3,4,5]->reduce(sub { add2() });
is( $v, 12, 'call sub');
is( $v, 12, 'call sub');


$v = [1,2,3]->reduce( sub { eval "$a + $b" } );
Expand All @@ -69,9 +71,9 @@ is($v, 12, 'return from loop');
# Does it work from another package?
# FIXME: this doesn't work
#{
# package Foo;
# $a = $b;
# ::is([1..4]->reduce( sub {$a*$b} ), 24, 'other package');
# package Foo;
# $a = $b;
# ::is([1..4]->reduce( sub {$a*$b} ), 24, 'other package');
#}


Expand All @@ -85,13 +87,13 @@ like($@, qr/^Can't undef active subroutine/, "undef active sub");
# running the Perl or XS implementation.

{
my $warn;
local $SIG{__WARN__} = sub { $warn = shift };
sub self_updating { local $^W; *self_updating = sub{1} ;1 }
eval { $v = [1,2]->reduce(\&self_updating) };
is($@, '', 'redefine self');
my $l = "line " . (__LINE__ - 3) . ".\n";
is($warn, "Subroutine main::self_updating redefined at t/reduce.t $l");
my $warn;
local $SIG{__WARN__} = sub { $warn = shift };
sub self_updating { local $^W; *self_updating = sub{1} ;1 }
eval { $v = [1,2]->reduce(\&self_updating) };
is($@, '', 'redefine self');
my $l = "line " . (__LINE__ - 3) . ".\n";
is($warn, "Subroutine main::self_updating redefined at t/reduce.t $l");
}

{ my $failed = 0;
Expand Down
14 changes: 8 additions & 6 deletions t/shuffle.t
@@ -1,3 +1,5 @@
#!perl

use perl5i;

use Test::More tests => 6;
Expand All @@ -6,17 +8,17 @@ use Test::More tests => 6;
my @r;

@r = []->shuffle;
ok( !@r, 'no args');
ok( !@r, 'no args');

@r = [9]->shuffle;
is( 0+@r, 1, '1 in 1 out');
is( $r[0], 9, 'one arg');
is( 0+@r, 1, '1 in 1 out');
is( $r[0], 9, 'one arg');

my @in = 1..100;
@r = @in->shuffle;
is( 0+@r, 0+@in, 'arg count');
is( 0+@r, 0+@in, 'arg count');

isnt( "@r", "@in", 'result different to args');
isnt( "@r", "@in", 'result different to args');

my @s = sort { $a <=> $b } @r;
is( "@in", "@s", 'values');
is( "@in", "@s", 'values');
4 changes: 3 additions & 1 deletion t/sum.t
@@ -1,9 +1,11 @@
#!perl

use perl5i;

use Test::More tests => 6;

my $v = []->sum;
is( $v, undef, 'no args');
is( $v, undef, 'no args');

$v = [(9)]->sum;
is( $v, 9, 'one arg');
Expand Down
2 changes: 1 addition & 1 deletion t/time_compat.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!perl -w

# Test compatibility with Perl's time stuff.

Expand Down
2 changes: 1 addition & 1 deletion t/y2038.t
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!perl

use perl5i;
use Test::More 'no_plan';
Expand Down

0 comments on commit 0b8a354

Please sign in to comment.