Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,12 @@ jobs:
- "5.24"
- "5.22"
- "5.20"
- "5.18"
- "5.16"
- "5.14"
- "5.12"
- "5.10"
- "5.8"

env:
CIP_TAG: ${{ matrix.cip_tag }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Bootstrap CIP
run: |
Expand All @@ -53,7 +47,7 @@ jobs:
cip cache-key

- name: Cache CPAN modules
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cip
key: ${{ runner.os }}-build-${{ steps.cache-key.outputs.key }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
CIP_TAG: static

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Bootstrap CIP
run: |
Expand Down
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}

{{$NEXT}}
- Drop support of Perl prior to 5.20

0.01 2022-09-29 06:33:02 -0600
- initial version
Expand Down
19 changes: 9 additions & 10 deletions lib/Test2/Tools/MemoryCycle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package Test2::Tools::MemoryCycle;

use strict;
use warnings;
use 5.008004;
use 5.020;
use feature qw( state );
use experimental qw( signatures );
use Devel::Cycle qw( find_cycle );
use Test2::API qw( context );
use Exporter qw( import );
Expand Down Expand Up @@ -54,9 +56,7 @@ Checks that C<$reference> doesn't have any circular memory references.
our @EXPORT = qw( memory_cycle_ok );

# Adapted from Test::Memory::Cycle for Test2::API
sub memory_cycle_ok {
my $ref = shift;
my $msg = shift;
sub memory_cycle_ok ($ref, $msg=undef) {

$msg ||= 'no memory cycle';

Expand Down Expand Up @@ -97,20 +97,19 @@ sub memory_cycle_ok {
return $ok;
} # memory_cycle_ok

my %shortnames;
my $new_shortname = "A";
sub _ref_shortname ($ref) {
state $shortnames = {};
state $new_shortname = "A";

sub _ref_shortname {
my $ref = shift;
my $refstr = "$ref";
my $refdisp = $shortnames{ $refstr };
my $refdisp = $shortnames->{ $refstr };
if ( !$refdisp ) {
my $sigil = ref($ref) . " ";
$sigil = '%' if $sigil eq "HASH ";
$sigil = '@' if $sigil eq "ARRAY ";
$sigil = '$' if $sigil eq "REF ";
$sigil = '&' if $sigil eq "CODE ";
$refdisp = $shortnames{ $refstr } = $sigil . $new_shortname++;
$refdisp = $shortnames->{ $refstr } = $sigil . $new_shortname++;
}

return $refdisp;
Expand Down
1 change: 1 addition & 0 deletions t/test2_tools_memorycycle.t
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use 5.020;
use Test2::V0 -no_srand => 1;
use Test2::Tools::MemoryCycle;

Expand Down
Loading