Skip to content

Commit

Permalink
rakudo.jvm fudge
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Sep 8, 2013
1 parent 9a4c899 commit 9f96263
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions S02-magicals/pid.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ L<A05/"RFC 332: Regex: Make /\$/ equivalent to /\z/ under the '/s' modifier" /Th

plan 1;

#?rakudo.jvm todo "this test may need to be skipped when using the eval server"
is_run 'say $*PID',
{
out => -> $p { $p > 0 && $p != $*PID },
Expand Down
1 change: 1 addition & 0 deletions S05-modifier/perl5_5.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){2}(.)/ && $0), "b", 're_tests 609/1 (793)');
is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){4,5}(.)/ && $0), "b", 're_tests 611/1 (795)');
is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){4,5}?(.)/ && $0), "d", 're_tests 613/1 (797)');
is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){6,7}(.)/ && $0), "e", 're_tests 615/1 (799)');
#?rakudo.jvm todo "nigh"
is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){6,7}?(.)/ && $0), "e", 're_tests 617/1 (801)');
is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){5,6}(.)/ && $0), "e", 're_tests 619/1 (803)');
is(("acdbcdbe" ~~ rx:P5/a(?:b|c|d){5,6}?(.)/ && $0), "b", 're_tests 621/1 (805)');
Expand Down
1 change: 1 addition & 0 deletions S06-advanced/callframe.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ my $baseline = 10;
isa_ok callframe(), CallFrame, 'callframe() returns a CallFrame';

sub f() {
#?rakudo.jvm todo "nigh"
is callframe().line, $baseline + 5, 'callframe().line';
ok callframe().file ~~ /« callframe »/, '.file';

Expand Down
4 changes: 4 additions & 0 deletions S06-other/main-usage.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ is_run 'sub MAIN() { print "MAIN() called" }; sub USAGE() { print "USAGE() calle
},
'a user-defined USAGE sub is not called if MAIN dispatch succeeds';

#?rakudo.jvm todo "nigh"
is_run 'sub MAIN( $a = nosuchsub()) { }; sub USAGE { say 42 }',
{
out => '',
err => /nosuchsub/,
},
'if the MAIN dispatch results in an error, that error should be printed, not USAGE';

#?rakudo.jvm todo "nigh"
is_run 'sub MAIN($foo) { }',
{
err => /<< foo >>/,
Expand Down Expand Up @@ -82,6 +84,7 @@ is_run 'sub MAIN(:xen(:$xin)) { print $xin }',
'named alias (outer name)';

# RT #71366
#?rakudo.jvm todo "nigh"
is_run 'sub MAIN($a, :$var) { say "a: $a, optional: $var"; }',
{
err => /\-\-var/,
Expand Down Expand Up @@ -160,6 +163,7 @@ is_run 'multi MAIN($) { print q[Any] }; multi MAIN(Str) { print q[Str] }',
},
'best multi matches (not just first one)';

#?rakudo.jvm todo "nigh"
is_run 'sub MAIN() { print 42 }', :args['--foo'],
{
out => '',
Expand Down
2 changes: 2 additions & 0 deletions S14-roles/anonymous.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ plan 13;
is $a, {:x}, "basic sanity";
my $role;
lives_ok { $role = role { has $.cool = "yeah" } }, "anonymous role definition";
#?rakudo.jvm todo "nigh"
lives_ok { $a does $role }, "anonymous role variable mixin";
is $a, {:x}, "still basic sanity";
#?rakudo.jvm todo "nigh"
is $a.cool, "yeah", "anonymous role variable gave us an attribute";
}

Expand Down
1 change: 1 addition & 0 deletions S19-command-line/dash-e.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ BEGIN { @*INC.push: 't/spec/packages' }
use Test::Util;

my Str $x;
#?rakudo.jvm 3 skip "nigh"
is_run $x, :args['-e', 'print q[Moin]'],
{
out => 'Moin',
Expand Down
2 changes: 2 additions & 0 deletions S29-context/die.t
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ is ({ try { die_in_return(); 23 }; 42 }()), 42, "die in return";
is "$!", $msg, 'die with no argument uses $!';
}

#?rakudo.jvm todo "nigh"
is_run( 'die "first line"',
{ status => sub { 0 != $^a },
out => '',
err => rx/'first line'/,
},
'die with no output' );

#?rakudo.jvm todo "nigh"
is_run( 'say "hello"; die "Nos morituri te salutant!\n"',
{ status => sub { 0 != $^a },
out => "hello\n",
Expand Down
2 changes: 2 additions & 0 deletions S29-context/exit.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ is_run 'say 3; exit; say 5',
{ out => "3\n", err => "", status => 0 },
'bare exit; works';

#?rakudo.jvm todo "nigh"
is_run 'say 3; exit 5; say 5',
{ out => "3\n", err => "", status => 5 +< 8 },
'exit 5; works';

#?rakudo.jvm todo "nigh"
is_run 'say 3; try { exit 5 }; say 5',
{ out => "3\n", err => "", status => 5 +< 8 },
'try-block does not catch exit exceptions';
Expand Down
1 change: 1 addition & 0 deletions S29-os/system.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if $*OS eq "browser" {
my $res;

$res = run($*EXECUTABLE_NAME,'-e1');
#?rakudo.jvm todo "nigh"
ok($res,"run() to an existing program does not die (and returns something true)");

$res = run("program_that_does_not_exist_ignore_this_error_please.exe");
Expand Down
2 changes: 2 additions & 0 deletions S32-basics/warn.t
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use Test::Util;
}

#?niecza todo
#?rakudo.jvm todo "nigh"
is_run 'use v6; warn; say "alive"',
{
status => 0,
Expand All @@ -54,6 +55,7 @@ is_run 'use v6; warn("OH NOEZ"); say "alive"',
},
'warn() with arguments; line number';

#?rakudo.jvm todo "nigh"
is_run 'use v6; try {warn("OH NOEZ") }; say "alive"',
{
status => 0,
Expand Down
10 changes: 10 additions & 0 deletions S32-exceptions/misc.t
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ throws_like '"a".match(:x([1, 2, 3]), /a/).Str', X::Str::Match::x, got => Array;
throws_like '"a".trans([Any.new] => [Any.new])', X::Str::Trans::IllegalKey, key => Any;
throws_like '"a".trans(rx/a/)', X::Str::Trans::InvalidArg, got => Regex;

#?rakudo.jvm skip "wrong exception type"
throws_like '1.foo', X::Method::NotFound, method => 'foo', typename => 'Int';
throws_like '1.+foo', X::Method::NotFound, method => 'foo', typename => 'Int';
throws_like 'my class Priv { method x { self!foo } }; Priv.x',
Expand All @@ -239,6 +240,7 @@ throws_like 'my class Priv { method x { self!foo } }; Priv.x',
typename => 'Priv',
private => { $_ === True };
# RT #77582
#?rakudo.jvm skip "wrong exception type"
throws_like 'my %h; %h.nosuchmethods', X::Method::NotFound, typename => 'Hash';

throws_like '1.List::join', X::Method::InvalidQualifier,
Expand Down Expand Up @@ -267,13 +269,19 @@ throws_like 'sub f() returns Str { 5 }; f', X::TypeCheck::Return, got => Int, ex
throws_like 'my Int $x = "foo"', X::TypeCheck::Assignment, got => 'foo',
expected => Int, symbol => '$x';

#?rakudo.jvm skip "wrong exception type"
throws_like 'sub f() { }; f() = 3', X::Assignment::RO;
#?rakudo.jvm skip "wrong exception type"
throws_like '1.0 = 3', X::Assignment::RO;
# RT #113534
#?rakudo.jvm skip "wrong exception type"
throws_like '120 = 3', X::Assignment::RO;
#?rakudo.jvm skip "wrong exception type"
throws_like '1e0 = 3', X::Assignment::RO;
#?rakudo.jvm skip "wrong exception type"
throws_like '"a" = 3', X::Assignment::RO;

#?rakudo.jvm skip "wrong exception type"
throws_like '1.foo', X::Method::NotFound, method => 'foo', typename => 'Int';
throws_like 'my class NC { }; NC.new does NC', X::Mixin::NotComposable,
:target(*.defined), :rolish(*.^name eq 'NC');
Expand Down Expand Up @@ -400,6 +408,7 @@ throws_like 'class Foobar is Foobar', X::Inheritance::SelfInherit, name => "Foob
throws_like q{if 10 > 5 { say "maths works!" } else if 10 == 5 { say "identity is weird" } else { say "math is weird" }}, X::Syntax::Malformed::Elsif;
}

#?rakudo.jvm skip "wrong exception type"
{
# RT #72958
throws_like q{1/2.''()}, X::Method::NotFound, method => '', typename => 'Int';
Expand All @@ -410,6 +419,7 @@ throws_like 'class Foobar is Foobar', X::Inheritance::SelfInherit, name => "Foob
throws_like q{role Bottle[::T] { method Str { "a bottle of {T}" } }; class Wine { ... }; say Bottle[Wine].new;}, X::Package::Stubbed;
}

#?rakudo.jvm skip "wrong exception type"
throws_like q[sub f() {CALLER::<$x>}; my $x; f], X::Caller::NotDynamic, symbol => '$x';

done;
7 changes: 7 additions & 0 deletions S32-io/IO-Socket-INET.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ use Test;

plan 41;

{
#?rakudo.jvm emit
skip_rest('rakudo.jvm systemic failures/OOM error');
#?rakudo.jvm emit
exit 0;
}

diag "{elapsed} starting tests";
my $elapsed;
sub elapsed {
Expand Down
5 changes: 5 additions & 0 deletions S32-io/note.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plan 6;

# L<S32::IO/Functions/note>

#?rakudo.jvm todo "nigh"
is_run( 'note "basic form"',
{
status => 0,
Expand All @@ -14,6 +15,7 @@ is_run( 'note "basic form"',
},
'basic form of note' );

#?rakudo.jvm todo "nigh"
is_run( 'note "multiple", " ", "params"',
{
status => 0,
Expand All @@ -22,6 +24,7 @@ is_run( 'note "multiple", " ", "params"',
},
'note multiple parameters' );

#?rakudo.jvm todo "nigh"
is_run( 'my @a = ("array", "of", "params"); note @a',
{
status => 0,
Expand All @@ -30,6 +33,7 @@ is_run( 'my @a = ("array", "of", "params"); note @a',
},
'note array' );

#?rakudo.jvm todo "nigh"
is_run( 'my $a = <stringify args>; note $a',
{
status => 0,
Expand All @@ -48,6 +52,7 @@ is_run( '"method form".note',
},
'method form of note' );

#?rakudo.jvm todo "nigh"
is_run( 'try { note "with try" }',
{
status => 0,
Expand Down
1 change: 1 addition & 0 deletions S32-io/spurt.t
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ sub all-basic(Callable $handle) {

# Corner cases
#?niecza skip "Unable to resolve method open in type IO"
#?rakudo.jvm skip "java.lang.StackOverflowError"
{
# Spurt on open handle
{
Expand Down
4 changes: 4 additions & 0 deletions S32-str/encode.t
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ ok ('ab'.encode('ASCII') eqv blob8.new(97, 98)), 'encoding to ASCII';
is 'ab'.encode('ASCII').elems, 2, 'right length of Buf';
ok ('ö'.encode('UTF-8') eqv utf8.new(195, 182)), 'encoding to UTF-8';
is 'ab'.encode('UTF-8').elems, 2, 'right length of Buf';
#?rakudo.jvm todo "nigh"
is 'ö'.encode('UTF-8')[0], 195, 'indexing a utf8 gives correct value (1)';
#?rakudo.jvm todo "nigh"
is 'ö'.encode('UTF-8')[1], 182, 'indexing a utf8 gives correct value (1)';

is 'abc'.encode()[0], 97, 'can index one element in a Buf';
Expand Down Expand Up @@ -39,7 +41,9 @@ is 'abc'.encode('ascii').list.join(','), '97,98,99', 'Buf.list gives list of cod

ok $temp = "\x1F63E".encode('UTF-16'), 'encode a string to UTF-16 surrogate pair';
ok $temp = utf16.new($temp), 'creating utf16 Buf from a surrogate pair';
#?rakudo.jvm todo "nigh"
is $temp[0], 0xD83D, 'indexing a utf16 gives correct value';
#?rakudo.jvm todo "nigh"
is $temp[1], 0xDE3E, 'indexing a utf16 gives correct value';
#?rakudo.parrot skip 'VMArray: index out of bounds'
is $temp.decode(), "\x1F63E", 'decoding utf16 Buf to original value';
Expand Down
9 changes: 9 additions & 0 deletions integration/error-reporting.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ BEGIN { @*INC.push('t/spec/packages') };

use Test::Util;

#?rakudo.jvm todo "nigh"
is_run "use v6;\n'a' =~ /foo/", {
status => { $_ != 0 },
out => '',
err => rx/<<2>>/
}, 'Parse error contains line number';

#?rakudo.jvm todo "nigh"
is_run "my \$x = 2 * 3;\ndie \$x", {
status => { $_ != 0 },
out => '',
err => all(rx/6/, rx/<<2>>/),
}, 'Runtime error contains line number';

#?rakudo.jvm todo "nigh"
is_run "use v6;\n\nsay 'Hello';\nsay 'a'.my_non_existent_method_6R5();",
{
status => { $_ != 0 },
Expand All @@ -27,6 +30,7 @@ is_run "use v6;\n\nsay 'Hello';\nsay 'a'.my_non_existent_method_6R5();",
}, 'Method not found error mentions method name and line number';

# RT #75446
#?rakudo.jvm todo "nigh"
is_run 'use v6;
sub bar {
pfff();
Expand All @@ -39,6 +43,7 @@ bar()',
err => all(rx/pfff/, rx/<<3>>/),
}, 'got the right line number for nonexisting sub inside another sub';

#?rakudo.jvm todo "nigh"
is_run 'say 42; nosuchsub()',
{
status => { $_ != 0 },
Expand All @@ -61,6 +66,7 @@ is_run 'say 42; nosuchsub()',
}

# RT #76112
#?rakudo.jvm todo "nigh"
is_run 'use v6;
class A { has $.x is rw };
A.new.x(42);',
Expand All @@ -71,6 +77,7 @@ A.new.x(42);',
}, 'got the right line number for accessors';

# RT #80982
#?rakudo.jvm todo "nigh"
is_run 'say 0080982',
{
status => 0,
Expand All @@ -88,6 +95,7 @@ is_run 'my $ = 2; my $ = 3; say q[alive]',
}, 'multiple anonymous variables do not warn or err out';

# RT #112724
#?rakudo.jvm todo "nigh"
is_run 'sub mysub {
+ Any # trigger an uninitialized warning
};
Expand All @@ -100,6 +108,7 @@ is_run 'sub mysub {

# RT #77736
#?niecza todo
#?rakudo.jvm todo "nigh"
is_run 'die "foo"; END { say "end run" }',
{
status => * != 0,
Expand Down

0 comments on commit 9f96263

Please sign in to comment.