Skip to content

Commit

Permalink
Use .raku instead of .perl in lib/*.rakumod
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jan 3, 2020
1 parent 8b22365 commit 7ce79f4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions lib/Pod/To/Text.rakumod
Expand Up @@ -94,13 +94,13 @@ sub declarator2text($pod) {
'sub ' ~ $_.name ~ signature2text($_.signature.params)
}
when .HOW ~~ Metamodel::ClassHOW {
'class ' ~ $_.perl
'class ' ~ $_.raku
}
when .HOW ~~ Metamodel::ModuleHOW {
'module ' ~ $_.perl
'module ' ~ $_.raku
}
when .HOW ~~ Metamodel::PackageHOW {
'package ' ~ $_.perl
'package ' ~ $_.raku
}
default {
''
Expand All @@ -115,7 +115,7 @@ sub signature2text($params) {
!! "()";
}
sub param2text($p) {
$p.perl ~ ',' ~ ( $p.WHY ?? ' # ' ~ $p.WHY !! ' ')
$p.raku ~ ',' ~ ( $p.WHY ?? ' # ' ~ $p.WHY !! ' ')
}

my %formats =
Expand Down
6 changes: 3 additions & 3 deletions lib/Telemetry.rakumod
Expand Up @@ -38,7 +38,7 @@ role Telemetry::Instrument::Snap does Associative {
nqp::p6bindattrinvres(
nqp::clone(self),::?CLASS,'$!data',nqp::decont(data))
}
multi method new(::?CLASS: *@data) { # provided for .perl roundtripping
multi method new(::?CLASS: *@data) { # provided for .raku roundtripping
my $data := nqp::list_i;
nqp::push_i($data,$_) for @data;
nqp::p6bindattrinvres(nqp::create(self),self,'$!data',$data)
Expand Down Expand Up @@ -589,7 +589,7 @@ class Telemetry does Associative {

$self
}
multi method new(Telemetry: *@samples) { # needed for .perl roundtripping
multi method new(Telemetry: *@samples) { # needed for .raku roundtripping
my $self := nqp::create(self);
nqp::bindattr($self,Telemetry,'$!sampler',
my $sampler := nqp::decont($*SAMPLER));
Expand All @@ -603,7 +603,7 @@ class Telemetry does Associative {
}

multi method perl(Telemetry:D: --> Str:D) {
self.^name ~ ".new$!samples.perl()"
self.^name ~ ".new$!samples.raku()"
}

method sampler() { $!sampler }
Expand Down
46 changes: 23 additions & 23 deletions lib/Test.rakumod
Expand Up @@ -181,8 +181,8 @@ multi sub is(Mu $got, Mu:D $expected, $desc = '') is export {
eq $expected.Str.subst(/\s/, '', :g)
{
# only white space differs, so better show it to the user
_diag "expected: $expected.perl()\n"
~ " got: $got.perl()";
_diag "expected: $expected.raku()\n"
~ " got: $got.raku()";
}
else {
_diag "expected: '$expected'\n"
Expand All @@ -209,8 +209,8 @@ multi sub isnt(Mu $got, Mu:U $expected, $desc = '') is export {
my $test = $got !=== $expected;
$ok = proclaim($test, $desc);
if !$test {
_diag "expected: anything except '$expected.perl()'\n"
~ " got: '$got.perl()'";
_diag "expected: anything except '$expected.raku()'\n"
~ " got: '$got.raku()'";
}
}
$time_before = nqp::time_n;
Expand All @@ -224,8 +224,8 @@ multi sub isnt(Mu $got, Mu:D $expected, $desc = '') is export {
my $test = $got ne $expected;
$ok = proclaim($test, $desc);
if !$test {
_diag "expected: anything except '$expected.perl()'\n"
~ " got: '$got.perl()'";
_diag "expected: anything except '$expected.raku()'\n"
~ " got: '$got.raku()'";
}
}
else {
Expand Down Expand Up @@ -253,16 +253,16 @@ multi sub cmp-ok(Mu $got is raw, $op, Mu $expected is raw, $desc = '') is export
if $matcher {
$ok = proclaim($matcher($got,$expected), $desc);
if !$ok {
my $expected-desc = (try $expected.perl) // $expected.gist;
my $got-desc = (try $got .perl) // $got .gist;
my $expected-desc = (try $expected.raku) // $expected.gist;
my $got-desc = (try $got .raku) // $got .gist;
_diag "expected: $expected-desc\n"
~ " matcher: '" ~ ($matcher.?name || $matcher.^name) ~ "'\n"
~ " got: $got-desc";
}
}
else {
$ok = proclaim(False, $desc);
_diag "Could not use '$op.perl()' as a comparator." ~ (
_diag "Could not use '$op.raku()' as a comparator." ~ (
' If you are trying to use a meta operator, pass it as a '
~ "Callable instead of a string: \&[$op]"
unless nqp::istype($op, Callable)
Expand Down Expand Up @@ -464,7 +464,7 @@ multi sub flunk($reason = '') is export {
}

multi sub isa-ok(
Mu $var, Mu $type, $desc = "The object is-a '$type.perl()'"
Mu $var, Mu $type, $desc = "The object is-a '$type.raku()'"
) is export {
$time_after = nqp::time_n;
my $ok = proclaim($var.isa($type), $desc)
Expand All @@ -474,19 +474,19 @@ multi sub isa-ok(
}

multi sub does-ok(
Mu $var, Mu $type, $desc = "The object does role '$type.perl()'"
Mu $var, Mu $type, $desc = "The object does role '$type.raku()'"
) is export {
$time_after = nqp::time_n;
my $ok = proclaim($var.does($type), $desc)
or _diag([~] 'Type: ', $var.^name, " doesn't do role ", $type.perl);
or _diag([~] 'Type: ', $var.^name, " doesn't do role ", $type.raku);
$time_before = nqp::time_n;
$ok or ($die_on_fail and die-on-fail) or $ok;
}

multi sub can-ok(
Mu $var, Str $meth,
$desc = ($var.defined ?? "An object of type '" !! "The type '")
~ "$var.WHAT.perl()' can do the method '$meth'"
~ "$var.WHAT.raku()' can do the method '$meth'"
) is export {
$time_after = nqp::time_n;
my $ok = proclaim($var.^can($meth), $desc);
Expand All @@ -496,24 +496,24 @@ multi sub can-ok(

multi sub like(
Str() $got, Regex:D $expected,
$desc = "text matches $expected.perl()"
$desc = "text matches $expected.raku()"
) is export {
$time_after = nqp::time_n;
my $ok := proclaim $got ~~ $expected, $desc
or _diag "expected a match with: $expected.perl()\n"
~ " got: $got.perl()";
or _diag "expected a match with: $expected.raku()\n"
~ " got: $got.raku()";
$time_before = nqp::time_n;
$ok or ($die_on_fail and die-on-fail) or $ok;
}

multi sub unlike(
Str() $got, Regex:D $expected,
$desc = "text does not match $expected.perl()"
$desc = "text does not match $expected.raku()"
) is export {
$time_after = nqp::time_n;
my $ok := proclaim !($got ~~ $expected), $desc
or _diag "expected no match with: $expected.perl()\n"
~ " got: $got.perl()";
or _diag "expected no match with: $expected.raku()\n"
~ " got: $got.raku()";
$time_before = nqp::time_n;
$ok or ($die_on_fail and die-on-fail) or $ok;
}
Expand Down Expand Up @@ -590,8 +590,8 @@ multi sub is-deeply(Mu $got, Mu $expected, $reason = '') is export {
my $test = _is_deeply( $got, $expected );
my $ok = proclaim($test, $reason);
if !$test {
my $got_perl = try { $got.perl };
my $expected_perl = try { $expected.perl };
my $got_perl = try { $got.raku };
my $expected_perl = try { $expected.raku };
if $got_perl.defined && $expected_perl.defined {
_diag "expected: $expected_perl\n"
~ " got: $got_perl";
Expand Down Expand Up @@ -626,7 +626,7 @@ sub throws-like($code, $ex_type, $reason?, *%matcher) is export {
my $ok = $got ~~ $v,;
ok $ok, ".$k matches $v.gist()";
unless $ok {
_diag "Expected: " ~ ($v ~~ Str ?? $v !! $v.perl)
_diag "Expected: " ~ ($v ~~ Str ?? $v !! $v.raku)
~ "\nGot: $got";
}
}
Expand Down Expand Up @@ -851,7 +851,7 @@ If you have 'p6doc' installed, you can do 'p6doc Language/testing'.
You can also check the documentation about testing in Perl 6 online on:
https://doc.perl6.org/language/testing
https://doc.raku.org/language/testing
=end pod

Expand Down

0 comments on commit 7ce79f4

Please sign in to comment.