Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pugs fudges
  • Loading branch information
coke committed Feb 26, 2012
1 parent 1bf4f1d commit b6ba504
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 19 deletions.
3 changes: 3 additions & 0 deletions S04-statements/while.t
Expand Up @@ -48,6 +48,7 @@ plan 9;
#?mildew skip 1
# L<S04/The C<for> statement/It is also possible to write>
# while ... -> $x {...}
#?pugs skip 'Cannot bind to non-existing variable: "$x"'
{
my @array = 1..5;
my $str = "";
Expand All @@ -58,6 +59,7 @@ plan 9;
}

#?mildew skip 1
#?pugs skip "Cannot 'pop' scalar"
{
my @array = 0..5;
my $str = "";
Expand All @@ -69,6 +71,7 @@ plan 9;

#?mildew skip 1
# L<S04/Statement parsing/keywords require whitespace>
#?pugs todo
{
eval_dies_ok('my $i = 1; while($i < 5) { $i++; }',
'keyword needs at least one whitespace after it');
Expand Down
8 changes: 6 additions & 2 deletions S05-modifier/perl5_0.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 17;
plan 24;

# Really really really minimal s:P5//// and m:P5 tests. Please add more!!

Expand Down Expand Up @@ -40,11 +40,11 @@ my $bad = "1 ";
$bad ~~ s:Perl5:g/\s*//;
is($bad, "1", 'Zero width replace works with :g');

#?pugs skip 'temp'
{
my $r;
temp $_ = 'heaao';
s:Perl5 /aa/ll/ && ($r = $_);
#?pugs todo 'bug'
is $r, 'hello', 's/// in boolean context properly defaults to $_';
}

Expand All @@ -57,8 +57,11 @@ is($vals, 2, 'returned two values in the match');

# return all the strings we matched
my @vals = "hello world" ~~ m:P5:g/(\w+)/;
#?pugs todo
is(+@vals, 2, 'returned two values in the match');
#?pugs todo
is(@vals[0], 'hello', 'returned correct first value in the match');
#?pugs todo
is(@vals[1], 'world', 'returned correct second value in the match');


Expand All @@ -79,6 +82,7 @@ so it looks like a pugs-pcre interface bug.

{
"a" ~~ m:Perl5/a|(b)/;
#?pugs todo
nok($0.defined, 'An unmatched capture should be undefined.');
my $str = "http://foo.bar/";
ok(($str ~~ m:Perl5 {http{0,1}}));
Expand Down
16 changes: 6 additions & 10 deletions S05-modifier/perl5_6.t
Expand Up @@ -11,13 +11,12 @@ unless "a" ~~ rx:P5/a/ {
exit;
}

force_todo(15..18); # PCRE hard parsefails

my $b = 'x';
my $backspace = "\b";
my $bang = '!';

is(("a\nb\nc\n" ~~ rx:P5/((?m)^b)/ && $0), "b", 're_tests 763/1 (959)');
#?pugs 2 skip 'reference to non-existent subpattern'
ok((not ("a" ~~ rx:P5/(?(1)a|b)/)), 're_tests 764 (960)');
is(("a" ~~ rx:P5/(?(1)b|a)/ && $/), "a", 're_tests 766/0 (962)');
ok((not ("a" ~~ rx:P5/(x)?(?(1)a|b)/)), 're_tests 768 (964)');
Expand All @@ -31,14 +30,11 @@ ok((not ("(blah" ~~ rx:P5/^(\()?blah(?(1)(\)))$/)), 're_tests 782 (978)');
is(("(blah)" ~~ rx:P5/^(\(+)?blah(?(1)(\)))$/ && $1), ")", 're_tests 784/2 (980)');
ok((not ("blah)" ~~ rx:P5/^(\(+)?blah(?(1)(\)))$/)), 're_tests 786 (982)');
ok((not ("(blah" ~~ rx:P5/^(\(+)?blah(?(1)(\)))$/)), 're_tests 788 (984)');
flunk("PCRE hard parsefail");
#ok((not ("a" ~~ rx:P5/(?(?{0})a|b)/)), 're_tests 790 (986)');
flunk("PCRE hard parsefail");
#is(("a" ~~ rx:P5/(?(?{0})b|a)/ && $/), "a", 're_tests 791/0 (987)');
flunk("PCRE hard parsefail");
#ok((not ("a" ~~ rx:P5/(?(?{1})b|a)/)), 're_tests 792 (988)');
flunk("PCRE hard parsefail");
#is(("a" ~~ rx:P5/(?(?{1})a|b)/ && $/), "a", 're_tests 793/0 (989)');
#?pugs 4 skip 'assertion expected after (?(")'
ok((not ("a" ~~ rx:P5/(?(?{0})a|b)/)), 're_tests 790 (986)');
is(("a" ~~ rx:P5/(?(?{0})b|a)/ && $/), "a", 're_tests 791/0 (987)');
ok((not ("a" ~~ rx:P5/(?(?{1})b|a)/)), 're_tests 792 (988)');
is(("a" ~~ rx:P5/(?(?{1})a|b)/ && $/), "a", 're_tests 793/0 (989)');
ok((not ("a" ~~ rx:P5/(?(?!a)a|b)/)), 're_tests 794 (990)');
is(("a" ~~ rx:P5/(?(?!a)b|a)/ && $/), "a", 're_tests 795/0 (991)');
ok((not ("a" ~~ rx:P5/(?(?=a)b|a)/)), 're_tests 796 (992)');
Expand Down
2 changes: 2 additions & 0 deletions S06-macros/returning-string.t
Expand Up @@ -11,8 +11,10 @@ plan 8;
macro dollar_foo { $was_in_macro = 1; '$COMPILING::foo' }
is $was_in_macro, 1, "string returning macro was called at compile time";
my $foo = 42;
#?pugs todo
is dollar_foo, $foo, "simple string returning macro (1)";
dollar_foo() = 23;
#?pugs todo
is $foo, 23, "simple string returning macro (2)";
}

Expand Down
2 changes: 2 additions & 0 deletions S14-roles/stubs.t
Expand Up @@ -7,6 +7,7 @@ role WithStub { method a() { ... } };
role ProvidesStub1 { method a() { 1 } };
role ProvidesStub2 { method a() { 2 } };

#?pugs todo
dies_ok { eval 'class A does WithStub { }' },
'need to implement stubbed methods at role-into-class composition time';
lives_ok { eval 'role B does WithStub { }' },
Expand All @@ -15,6 +16,7 @@ lives_ok { eval 'class C does WithStub { method a() { 3 } }' },
'directly implementing the stubbed method is fine';
lives_ok { eval 'class D does WithStub does ProvidesStub1 { }' },
'composing the stubbed method is fine';
#?pugs todo
dies_ok { eval 'class E does WithStub does ProvidesStub1 does ProvidesStub2 { }' },
'composing stub and 2 implementations dies again';
lives_ok { eval 'class F does WithStub does ProvidesStub1 does ProvidesStub2 {
Expand Down
4 changes: 2 additions & 2 deletions S32-container/roundrobin.t
Expand Up @@ -32,10 +32,10 @@ ok(roundrobin({'a'=>1,'b'=>2,'c'=>3}) eqv ('a'=>1,'b'=>2,'c'=>3),
ok(roundrobin((); 1; 2..4; [5..7]; {'a'=>1,'b'=>2})
eqv (1, 2, 5, 'a'=>1, 3, 6, 'b'=>2, 4, 7), 'basic roundrobin');

#?pugs todo 'feature'
#?pugs skip 'Named argument found where no matched parameter expected'
ok(roundrobin(:shortest, 1; 1..2; 1..3) eqv (1), 'roundrobin :shortest');

#?pugs todo 'these tests depend on lazy roundrobin'
#?pugs todo
flunk('roundrobin :finite');

=begin lazy_roundrobin
Expand Down
4 changes: 3 additions & 1 deletion S32-container/zip.t
Expand Up @@ -74,16 +74,18 @@ plan 12;
is(@b, [2, 4], "second half of the lvalue zip");
}

#?pugs todo
{
my @a = (1..3, 5) Z (6..8, 10);
is @a.join(', '), "1, 6, 2, 7, 3, 8, 5, 10", 'infix:<Z> imposes list context';
}

# mix arrays and ranges

#?pugs todo
is ('a'..'c' Z 1, 2, 3).join(','), 'a,1,b,2,c,3',
'can mix arrays and ranges for infix:<Z>';

#?pugs todo
is ("a".."c" Z "?", "a".."b").join('|'), 'a|?|b|a|c|b',
'can mix arrays and ranges for infix:<Z>';

Expand Down
1 change: 1 addition & 0 deletions S32-list/create.t
Expand Up @@ -17,6 +17,7 @@ is($list_sub, (1, 2, 3), 'The &list() function created a list.');
is(+$list_sub, 3, 'Finding the length of the list works as expected.');

#?niecza skip 'Excess arguments to List.new, used 1 of 4 positionals'
#?pugs skip 'Must only use named arguments to new() constructor'
{
my $list_obj = List.new(4, 5, 6);
isa_ok($list_obj, List, 'Creating a new list object with new works.');
Expand Down
5 changes: 5 additions & 0 deletions S32-list/reverse.t
Expand Up @@ -22,6 +22,7 @@ is(@a, @e, "list was reversed");

{
my $a = reverse("foo");
#?pugs todo
is($a, "foo", "string was not reversed; that's what flip() is for");

@a = reverse "foo", "bar";
Expand Down Expand Up @@ -65,9 +66,11 @@ is(@a, @e, "list was reversed");
my @a = "foo";
my @b = @a.reverse;
#?niecza skip "Iterable NYI"
#?pugs skip "Iterable NYI"
isa_ok(@b, Iterable);
my $b = @a.reverse;
#?niecza skip "Iterable NYI"
#?pugs skip "Iterable NYI"
isa_ok($b, Iterable);
is(@b[0], "foo", 'our list is reversed properly');
is($b, "foo", 'in scalar context it is still a list');
Expand All @@ -80,9 +83,11 @@ is(@a, @e, "list was reversed");
my @a = ("foo", "bar");
my @b = @a.reverse;
#?niecza skip "Iterable NYI"
#?pugs skip "Iterable NYI"
isa_ok(@b, Iterable);
my $b = @a.reverse;
#?niecza skip "Iterable NYI"
#?pugs skip "Iterable NYI"
isa_ok($b, Iterable);
is(@b[0], "bar", 'our array is reversed');
is(@b[1], "foo", 'our array is reversed');
Expand Down
3 changes: 3 additions & 0 deletions S32-num/abs.t
Expand Up @@ -14,6 +14,7 @@ for 0, 0 / 1, 0.0e0, 1, 50, 60.0e0, 99.99 -> $x {
is(abs($x), $x, "got the right absolute value for $x");
is($x.abs, $x, 'got the right absolute value for $x='~$x);

#?pugs 2 skip '.gist'
is (abs($x)).WHAT.gist, $x.WHAT.gist, 'type of abs($x) agrees with type of $x';
is $x.abs.WHAT.gist, $x.WHAT.gist, 'type of $x.abs agrees with type of $x';
}
Expand All @@ -22,6 +23,7 @@ for -1, -50, -60.0e0, -9999 / 100 {
is(abs($_), -$_, "got the right absolute value for $_");
is(.abs, -$_, 'got the right absolute value for $_='~$_);

#?pugs 2 skip '.gist'
is (abs($_)).WHAT.gist, $_.WHAT.gist, 'type of abs($_) agrees with type of $_';
is $_.abs.WHAT.gist, $_.WHAT.gist, 'type of $_.abs agrees with type of $_';
}
Expand All @@ -33,6 +35,7 @@ is( abs(-Inf), Inf, 'absolute value of -Inf is Inf');
is( abs("-10"), 10, 'absolute value of "-10" is 10');

#?rakudo todo "abs(70596).WHAT parsing as abs(70596.WHAT)"
#?pugs skip '.gist'
is( abs(70596).WHAT.gist, 70596.abs.WHAT.gist, 'abs(x).WHAT parses as x.abs.WHAT' );

done;
Expand Down
5 changes: 1 addition & 4 deletions S32-num/log.t
Expand Up @@ -20,6 +20,7 @@ is_approx(log(5), $log_5, 'got the log of 5');
is_approx(log(0.1), $log_one_tenth, 'got the log of 0.1');

# with given base:
#?pugs 3 skip 'No compatible multi variant found: "&log"'
is_approx(log(8, 2), 3, 'log(8, 2) is 3');
is_approx(log(42, 23), 1.192051192, 'log(42, 23)');

Expand Down Expand Up @@ -49,24 +50,20 @@ is( log10(NaN), NaN, 'log10(NaN) = NaN');
# I use 1i instead of i since I don't know if a bare i will be supported

# log(exp(i pi)) = i pi log(exp(1)) = i pi
#?pugs 2 todo 'feature'
is_approx(log(-1 + 0i,), 0 + 1i * $pi, "got the log of -1");
is_approx(log10(-1 + 0i), 0 + 1i * $pi / log(10), "got the log10 of -1");

# log(exp(1+i pi)) = 1 + i pi
#?pugs 2 todo 'feature'
is_approx(log(-exp(1) + 0i), 1 + 1i * $pi, "got the log of -e");
is_approx(log10(-10 + 0i), 1 + 1i * $pi / log(10), "got the log10 of -10");
is_approx(log10(10), 1.0, 'log10(10)=1');

#?pugs todo 'feature'
is_approx(log((1+1i) / sqrt(2)), 0 + 1i * $pi / 4, "got log of exp(i pi/4)");
is_approx(log(1i), 1i * $pi / 2, "got the log of i (complex unit)");

is_approx(log10(1i), 1i * $pi / (2*log(10)), 'got the log10 of i');
is_approx(log10((1+1i) / sqrt(2)), 0 + 1i * $pi / (4*log(10)), "got log10 of exp(i pi/4)");

#?pugs todo 'feature'
is_approx(log(-1i), -0.5i * $pi , "got the log of -i (complex unit)");
is_approx(log10(-1i), -0.5i * $pi / log(10), "got the log10 of -i (complex unit)");

Expand Down

0 comments on commit b6ba504

Please sign in to comment.