Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
onearg any/all/one/none
  • Loading branch information
TimToady committed Sep 19, 2015
1 parent 8e7418f commit 445fb73
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
9 changes: 1 addition & 8 deletions S03-junctions/boolean-context.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 77;
plan 74;

# L<S03/Junctive operators/>

Expand Down Expand Up @@ -136,13 +136,6 @@ ok do if 1 | 2 | 3 <= 3 <= 2 { 0 } else { 1 };
ok do if 1 <= 1 & 2 & 3 & 4 <= 4 { 1 } else { 0 };
ok do if 1 <= 1 & 2 & 3 & 4 <= 3 { 0 } else { 1 };

{
my @a = 2, 3;
ok do if any(1, @a, 4) == 3 { 1 } else { 0 }, "flattening in any works";
ok do if all(1, @a, 4) <= 4 { 1 } else { 0 }, "flattening in all works";
ok do if none(1, @a, 4) > 4 { 1 } else { 0 }, "flattening in none works";
}

# RT 117579
{
ok do if 1 ne 2|3|4 { 1 } else { 0 }, "ne in if context";
Expand Down
26 changes: 13 additions & 13 deletions S03-junctions/misc.t
Expand Up @@ -426,23 +426,23 @@ ok (1|2).Str ~~ Str, 'Junction.Str returns a Str, not a Junction';
ok (0|1 == 0&1), 'test junction evaluation order';
ok (0&1 == 0|1), 'test junction evaluation order';

# test flattening of listop forms
# test non-flattening of listop forms

ok any((1,2,3),(4,5,6)) == 4, 'any is flattening 1';
nok any((1,2,4),(4,5,6)) == 3, 'any is flattening 2';
is (any((1,2,3),(4,5,6)) == 3).gist, 'any(False, False, True, False, False, False)', 'any is flattening 3';
ok any((1,2,3),(4,5,6)) eqv (1,2,3), 'any is not flattening 1';
nok any((1,2,4),(4,5,6)) == 2, 'any is not flattening 2';
is (any((1,2,3),(4,5,6)) eqv (4,5,6)).gist, 'any(False, True)', 'any is not flattening 3';

ok all((4,5,6),(4,5,6)) > 3, 'all is flattening 1';
nok all((1,2,3),(4,5,6)) == 3, 'all is flattening 2';
is (all((1,2,3),(4,5,6)) == 3).gist, 'all(False, False, True, False, False, False)', 'all is flattening 3';
ok all((4,5,6),(4,5,6)) eqv (4,5,6), 'all is not flattening 1';
ok all((1,2,3),(4,5,6)) == 3, 'all is non flattening 2';
is (all((1,2,3),(4,5,6)) eqv (4,5,6)).gist, 'all(False, True)', 'all is not flattening 3';

ok one((4,5,6),(4,5,6,7)) == 7, 'one is flattening 1';
nok one((1,2,3),(4,5,6)) eq '1 2 3' , 'one is flattening 2';
is (one((1,2,3),(4,5,6)) == 3).gist, 'one(False, False, True, False, False, False)', 'one is flattening 3';
ok one((4,5,6),(4,5,6,7)) eqv (4,5,6,7), 'one is not flattening 1';
nok one((1,2,3),(4,5,6)) eq '3' , 'one is not flattening 2';
is (one((1,2,3),(4,5,6)) eqv (1,2,3)).gist, 'one(True, False)', 'one is not flattening 3';

ok none((4,5,6),(4,5,6,7)) == 3, 'none is flattening 1';
nok none((1,2,3,4),(4,5,6,7)) == '3' , 'none is flattening 2';
is (none((1,2,3),(4,5,6)) == 3).gist, 'none(False, False, True, False, False, False)', 'none is flattening 3';
ok none((4,5,6),(4,5,6)) == 4, 'none is not flattening 1';
ok none((1,2,3,4),(4,5,6,7)) eq '3' , 'none is not flattening 2';
is (none(1,2,3,(4,5,6)) == 3).gist, 'none(False, False, True, True)', 'none is not flattening 3';

# test non-flattening of method forms

Expand Down

0 comments on commit 445fb73

Please sign in to comment.