Skip to content

Commit

Permalink
0.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Aug 10, 2023
1 parent bfe5717 commit 1b95045
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 47 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ Revision history for P5caller

{{$NEXT}}

0.0.13 2023-08-10T18:02:54+02:00
- Update test file extension
- Removed deprecations
- Added sponsor link

0.0.12 2021-09-09T11:04:02+02:00
- Change file extension to .rakumod
- Migrate to zef ecosystem
Expand Down
2 changes: 1 addition & 1 deletion META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
],
"test-depends": [
],
"version": "0.0.12"
"version": "0.0.13"
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ AUTHOR

Elizabeth Mattijsen <liz@raku.rocks>

If you like this module, or what I’m doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me!

Source can be located at: https://github.com/lizmat/P5caller . Comments and Pull Requests are welcome.

COPYRIGHT AND LICENSE
=====================

Copyright 2018, 2019, 2020, 2021 Elizabeth Mattijsen
Copyright 2018, 2019, 2020, 2021, 2023 Elizabeth Mattijsen

Re-imagined from Perl as part of the CPAN Butterfly Plan.

Expand Down
20 changes: 6 additions & 14 deletions lib/P5caller.rakumod
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
use v6.*;

unit module P5caller:ver<0.0.12>:auth<zef:lizmat>;
unit module P5caller;

proto sub caller(|) is export {*}
multi sub caller(Scalar:U) { backtrace(1, True) }
multi sub caller(:$scalar!)
is DEPRECATED('Scalar as first positional')
{
backtrace(1, True)
}
multi sub caller() { backtrace(1, False) }
multi sub caller(Scalar:U, Int() $down) { backtrace($down, True) }
multi sub caller(Int() $down, :$scalar!)
is DEPRECATED('Scalar as first positional')
{
backtrace($down, True)
}
multi sub caller(Int() $down) { backtrace($down, False) }

my sub backtrace($down, $scalar) {
Expand Down Expand Up @@ -145,12 +133,16 @@ return value.
Elizabeth Mattijsen <liz@raku.rocks>
If you like this module, or what I’m doing more generally, committing to a
L<small sponsorship|https://github.com/sponsors/lizmat/> would mean a great
deal to me!
Source can be located at: https://github.com/lizmat/P5caller . Comments and
Pull Requests are welcome.
=head1 COPYRIGHT AND LICENSE
Copyright 2018, 2019, 2020, 2021 Elizabeth Mattijsen
Copyright 2018, 2019, 2020, 2021, 2023 Elizabeth Mattijsen
Re-imagined from Perl as part of the CPAN Butterfly Plan.
Expand Down
56 changes: 35 additions & 21 deletions run-tests
Original file line number Diff line number Diff line change
@@ -1,37 +1,51 @@
unit sub MAIN(:$author);

say run(<raku --version>, :out).out.slurp.chomp;
say "Running on $*DISTRO.gist().\n";

say "Testing {"dist.ini".IO.lines.head.substr(7)}";
say "Testing {
"dist.ini".IO.lines.head.substr(7)
}{
" including author tests" if $author
}";

my @failed;
my $done = 0;
for "t".IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort {
say "=== $_";
my $proc = run "raku", "--ll-exception", "-Ilib", $_, :out, :err, :merge;
if $proc {
$proc.out.slurp;
}
else {
@failed.push($_);
if $proc.out.slurp -> $stdout {
my @lines = $stdout.lines;
with @lines.first(*.starts-with(" from gen/moar/stage2"),:k) -> $index {
say @lines[^$index].join("\n");

sub test-dir($dir) {
for $dir.IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort {
say "=== $_";
my $proc := run "raku", "--ll-exception", "-I.", $_, :out,:err,:merge;
if $proc {
$proc.out.slurp;
}
else {
@failed.push($_);
if $proc.out.slurp -> $stdout {
my @lines = $stdout.lines;
with @lines.first(
*.starts-with(" from gen/moar/stage2"),:k)
-> $index {
say @lines[^$index].join("\n");
}
else {
say $stdout;
}
}
elsif $proc.err -> $stderr {
say .slurp with $stderr;
}
else {
say $stdout;
say "No output received, exit-code $proc.exitcode() ($proc.signal())";
}
}
elsif $proc.err -> $stderr {
say .slurp with $stderr;
}
else {
say "No output received, exit-code $proc.exitcode() ($proc.signal())";
}
$done++;
}
$done++;
}

test-dir("t");
test-dir("xt") if $author;

if @failed {
say "FAILED: {+@failed} of $done:";
say " $_" for @failed;
Expand Down
12 changes: 2 additions & 10 deletions t/01-basic.t → t/01-basic.rakutest
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use v6.*;
use Test;
use P5caller;
%*ENV<RAKUDO_NO_DEPRECATIONS> = True;

plan 14;
plan 12;

ok defined(::('&caller')), 'is &caller imported?';
ok !defined(P5caller::{'&caller'}), 'is &caller externally NOT accessible?';
ok defined(::('&caller')), 'is &caller imported?';

sub foo { bar }
my $the-line = $?LINE - 1;
Expand All @@ -26,9 +23,4 @@ sub BAZ() {
}
BAZ();

sub baz() {
is caller(:scalar), 'GLOBAL', 'did we get the right package name';
}
baz();

# vim: expandtab shiftwidth=4

0 comments on commit 1b95045

Please sign in to comment.