Skip to content

Commit

Permalink
pugs fudges
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Feb 26, 2012
1 parent 454fdc3 commit e4b089d
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 5 deletions.
2 changes: 2 additions & 0 deletions S02-literals/string-interpolation.t
Expand Up @@ -44,7 +44,9 @@ line 4
}

{
#?pugs todo
is 'something'.new, '', '"string literal".new just creates an empty string';
#?pugs skip 'Cannot cast from VObject'
is +''.new, 0, '... and that strinig works normally';
}

Expand Down
9 changes: 9 additions & 0 deletions S02-names/symbolic-deref.t
Expand Up @@ -50,12 +50,15 @@ my $outer = 'outside';
my $inner = 'inside';

ok ::('Int') === Int, 'can look up a type object with ::()';
#?pugs 3 skip 'Invalid sigil ":$"'
is ::('$inner'), $inner, 'can look up lexical from same block';
is ::('$outer'), $outer, 'can look up lexical from outer block';

lives_ok { ::('$outer') = 'new' }, 'Can use ::() as lvalue';
#?pugs todo
is $outer, 'new', 'and the assignment worked';
sub c { 'sub c' }; #OK not used
#?pugs 2 skip 'Invalid sigil ":&"'
is ::('&c').(), 'sub c', 'can look up lexical sub';

is ::('e'), e, 'Can look up numerical constants';
Expand All @@ -68,6 +71,7 @@ my $outer = 'outside';

class A::B { };

#?pugs 2 skip 'No such subroutine'
is ::('Outer::Inner').perl, Outer::Inner.perl, 'can look up name with :: (1)';
is ::('A::B').perl, A::B.perl, 'can look up name with :: (1)';
}
Expand Down Expand Up @@ -109,22 +113,26 @@ my $outer = 'outside';
#?rakudo skip 'NYI'
{
sub GLOBAL::a_global_sub () { 42 }
#?pugs skip 'Invalid sigil'
is ::("&*a_global_sub")(), 42,
"symbolic dereferentiation of globals works (1)";

my $*a_global_var = 42;
#?pugs skip 'Invalid sigil'
is ::('$*a_global_var'), 42,
"symbolic dereferentiation of globals works (2)";
}

# Symbolic dereferentiation of globals *without the star*
#?rakudo skip 'NYI'
{
#?pugs skip 'Invalid sigil'
cmp_ok ::('$*IN'), &infix:<===>, $*IN,
"symbolic dereferentiation of globals works (3)";

cmp_ok &::("say"), &infix:<===>, &say,
"symbolic dereferentiation of CORE subs works (1)";
#?pugs skip "todo"
ok &::("so")(42),
"symbolic dereferentiation of CORE subs works (2)";
is &::("truncate")(3.1), 3,
Expand Down Expand Up @@ -153,6 +161,7 @@ my $outer = 'outside';
try { die 'to set $!' };
ok $::("!"), "symbolic dereferentiation works with special chars (1)";
# ok $::!, "symbolic dereferentiation works with special chars (2)";
#?pugs skip 'todo'
ok ::("%*ENV"), "symbolic dereferentiation works with special chars (3)";
# ok %::*ENV, "symbolic dereferentiation works with special chars (4)";
}
Expand Down
5 changes: 4 additions & 1 deletion S02-types/mixed_multi_dimensional.t
Expand Up @@ -52,7 +52,9 @@ Some deeper tests were already added.

@array[0] = %hash;
is(+@array, 1, 'the array has one value in it');
#?pugs todo
isa_ok(@array[0], Hash);
#?pugs 2 skip 'Cannot cast into a Hash'
is(@array[0]{"key"}, 'value', 'got the right value for key');
is(@array[0]<key1>, 'value1', 'got the right value1 for key1');
}
Expand Down Expand Up @@ -199,14 +201,15 @@ Some deeper tests were already added.
@array[2]<two>[0]<f><other> = 5;
#?rakudo todo 'isa hash'
isa_ok(@array[1]<two>[0], Hash);
#?pugs 3 todo 'bug'
#?rakudo todo 'isa hash'
#?niecza todo
#?pugs todo
isa_ok(@array[1]<two>[0]<f>, Hash);
#?rakudo 2 todo 'unknown'
#?niecza todo
is(+@array[1]<two>[0], 2, "two keys at level 4");
#?niecza todo 'more keys at level 4'
#?pugs todo
is(@array[1]<two>[0]<f><other>, 5, "more keys at level 4");
}

Expand Down
8 changes: 8 additions & 0 deletions S02-types/nan.t
Expand Up @@ -22,19 +22,27 @@ is Inf**0 , 1, "Inf**0 is 1, _not_ NaN";

ok NaN ~~ NaN, 'NaN is a NaN';
nok 4 ~~ NaN, '4 is not a NaN';
#?pugs skip '.Num'
nok 4.Num ~~ NaN, "4.Num is not a NaN";

isa_ok NaN + 1i, Complex, "NaN + 1i is a Complex number";
#?pugs todo
ok NaN + 1i ~~ NaN, "NaN + 1i ~~ NaN";
#?pugs todo
ok NaN ~~ NaN + 1i, "NaN ~~ NaN + 1i";

isa_ok (NaN)i, Complex, "(NaN)i is a Complex number";
#?pugs todo
ok (NaN)i ~~ NaN, "(NaN)i ~~ NaN";
#?pugs todo
ok NaN ~~ (NaN)i, "NaN ~~ (NaN)i";

#?pugs todo
ok (NaN)i ~~ NaN + 1i, "(NaN)i ~~ NaN + 1i";
#?pugs todo
ok NaN + 1i ~~ (NaN)i, "NaN + 1i ~~ (NaN)i";

#?pugs todo
ok truncate(NaN) ~~ NaN, 'truncate(NaN) ~~ NaN';

#?rakudo skip 'RT 83446'
Expand Down
2 changes: 2 additions & 0 deletions S03-binding/arrays.t
Expand Up @@ -129,6 +129,7 @@ plan 47;
is ~@array, "a new_value c", "passing an array to a slurpying sub behaves correctly (2)";
}

#?pugs skip "Can't modify constant item: VUndef"
{
my sub foo (*@args) { push @args, "new_value" }

Expand Down Expand Up @@ -229,6 +230,7 @@ plan 47;

# RT #61566
#?niecza todo
#?pugs todo
{
eval_dies_ok 'my @rt61566 := 1', 'can only bind Positional stuff to @a';
# TODO: check that the error is the right one
Expand Down
1 change: 1 addition & 0 deletions S03-operators/bit.t
Expand Up @@ -50,6 +50,7 @@ plan 27;
is( 33023 +> 7, 257, 'shift seven bits right' );
}

#?pugs skip 'No such method in class Rat: "&Num"'
{
# Tests to see if you really can do casts negative floats to unsigned properly
my $neg1 = -1.0.Num;
Expand Down
3 changes: 3 additions & 0 deletions S04-blocks-and-statements/pointy.t
Expand Up @@ -47,6 +47,7 @@ my $s = -> {
dies_ok $s, 'pointy with block control exceptions';
#?rakudo todo 'pointy blocks and last/redo'
#?niecza todo
#?pugs todo
is $n, 10, "pointy control exceptions ran";

# L<S06/""Pointy blocks""/will return from the innermost enclosing sub or method>
Expand Down Expand Up @@ -78,6 +79,7 @@ is $str, 'inner', 'return in pointy returns from enclosing sub';

# -> { $^a, $^b } is illegal; you can't mix real sigs with placeholders,
# and the -> introduces a sig of (). TimToady #perl6 2008-May-24
#?pugs todo
eval_dies_ok(q{{ -> { $^a, $^b } }}, '-> { $^a, $^b } is illegal');

# RT #61034
Expand All @@ -92,6 +94,7 @@ lives_ok {my $x = -> {}; my $y = $x(); },

#?rakudo skip 'Could not find non-existent sub junction'
#?niecza skip 'Could not find non-existent sub junction'
#?pugs skip 'No such subroutine: "&junction'
{
my @a = any(3, 4);
my $ok = 0;
Expand Down
9 changes: 9 additions & 0 deletions S04-phasers/start.t
Expand Up @@ -6,6 +6,7 @@ plan 21;

# L<S04/"Phasers"/START "runs separately for each clone">
#?rakudo todo '$_ inside START has some issues, it seems'
#?pugs todo
{
is(eval(q{{
my $str;
Expand All @@ -32,6 +33,7 @@ plan 21;
is $var, 2, 'START {} has executed';

$sub(3);
#?pugs todo
is $var, 2, "START {} only runs once for each clone";
}

Expand All @@ -41,6 +43,7 @@ plan 21;
{
START { $str ~= 'i' }
}
#?pugs todo
is $str, 'oi', 'START {} runs when we first try to use a block';
}

Expand All @@ -57,7 +60,9 @@ for <first second> {
};

is $sub(), ':oIi', "START block set \$str to 3 ($_ time)";
#?pugs todo
is $sub(), ':o', "START wasn't invoked again (1-1) ($_ time)";
#?pugs todo
is $sub(), ':o', "START wasn't invoked again (1-2) ($_ time)";
}

Expand All @@ -73,7 +78,9 @@ for <first second> {
};

$sub(); $sub();
#?pugs todo
is $ran, 1, "START block ran exactly once ($_ time)";
#?pugs todo
is $str, 'banana', "START block modified the correct variable ($_ time)";
}

Expand All @@ -90,11 +97,13 @@ for <first second> {
is $sub(), 23, 'START {} block set our variable (2)';
#?niecza todo
is $sub(), 23, 'the returned value of START {} still there';
#?pugs todo
is $was_in_start, 1, 'our START {} block was invoked exactly once';
}

# Test that START {} blocks are executed only once even if they return undefined
# (the first implementation ran them twice instead).
#?pugs skip 'No such subroutine: "&Mu"'
{
my $was_in_start;
my $sub = { START { $was_in_start++; Mu } };
Expand Down
12 changes: 12 additions & 0 deletions S05-metasyntax/repeat.t
Expand Up @@ -19,7 +19,9 @@ plan 22;
# L<S05/Bracket rationalization/The general repetition specifier is now>

# Exact repetition
#?pugs todo
ok("abcabcabcabcd" ~~ m/'abc'**4/, 'Fixed exact repetition');
#?pugs todo
is $/, 'abc' x 4, '...with the correct capture';
ok(!("abcabcabcabcd" ~~ m/'abc'**5/), 'Fail fixed exact repetition');
#?pugs todo force_todo
Expand All @@ -28,6 +30,7 @@ ok("abcabcabcabcd" ~~ m/'abc'**{4}/, 'Fixed exact repetition using closure');
ok(!( "abcabcabcabcd" ~~ m/'abc'**{5}/ ), 'Fail fixed exact repetition using closure');

# Closed range repetition
#?pugs todo
ok("abcabcabcabcd" ~~ m/'abc'**2..4/, 'Fixed range repetition');
ok(!( "abc" ~~ m/'abc'**2..4/ ), 'Fail fixed range repetition');
#?pugs todo force_todo
Expand All @@ -36,6 +39,7 @@ ok("abcabcabcabcd" ~~ m/'abc'**{2..4}/, 'Fixed range repetition using closure');
ok(!( "abc" ~~ m/'abc'**{2..4}/ ), 'Fail fixed range repetition using closure');

# Open range repetition
#?pugs todo
ok("abcabcabcabcd" ~~ m/'abc'**2..*/, 'Open range repetition');
ok(!( "abcd" ~~ m/'abc'**2..*/ ), 'Fail open range repetition');
#?pugs todo force_todo
Expand All @@ -44,19 +48,27 @@ ok("abcabcabcabcd" ~~ m/'abc'**{2..*}/, 'Open range repetition using closure');
ok(!( "abcd" ~~ m/'abc'**{2..*}/), 'Fail open range repetition using closure');

# It is illegal to return a list, so this easy mistake fails:
#?pugs todo
eval_dies_ok('"foo" ~~ m/o{1,3}/', 'P5-style {1,3} range mistake is caught');
#?pugs todo
eval_dies_ok('"foo" ~~ m/o{1,}/', 'P5-style {1,} range mistake is caught');

#?pugs todo
is(~('foo,bar,baz,' ~~ m/[<alpha>+]+ % ','/), 'foo,bar,baz', '% with a term worked');
#?pugs todo
is(~('foo,bar,baz,' ~~ m/[<alpha>+]+ %% ','/), 'foo,bar,baz,', '%% with a term worked');
#?pugs todo
is(~('foo, bar,' ~~ m/[<alpha>+]+ % [','\s*]/), 'foo, bar', '% with a more complex term');

#?rakudo 3 skip 'nom regression'
ok 'a, b, c' !~~ /:s^<alpha>+%\,$/, 'with no spaces around %, no spaces can be matched';
#?pugs todo
ok 'a, b, c' ~~ /:s^ <alpha>+ % \, $/, 'with spaces around %, spaces can be matched';
#?pugs todo
ok 'a , b ,c' ~~ /:s^ <alpha>+ % \, $/, 'same, but with leading spaces';

# RT #76792
#?pugs todo
ok ('a b,c,d' ~~ token { \w \s \w+ % \, }), 'can combine % with backslash character classes';

# vim: ft=perl6

0 comments on commit e4b089d

Please sign in to comment.