FWIW: Here my workaround for the afterworld
use strict; use warnings; use Test::More; my ($pos1,$pos2)=("a","a"); # *** Those should pass suite(\$pos1,\$pos1); # *** Those should fail suite(\$pos1,\$pos2); done_testing; # --- my tests for various scalar refs sub suite { my ($ref1,$ref2) = @_; is_deeply( scr($ref1), scr($ref2), "is_deeply"); is_deeply( scr([$ref1]), scr([$ref2]), "is_deeply ARRAY"); is_deeply( scr({t=> $ref1}), scr({t=>$ref2}), "is_deeply HASH"); is_deeply( scr({t => [$ref1]}), scr({t => [$ref2]}), "is_deeply HoA"); is_deeply( scr({t => [$ref1,$ref1], t2 => [$ref1]}), scr({t => [$ref2,$ref2], t2 => [$ref2]}), "is_deeply HoA multiple refs"); } # --- stringify_scalar_refs sub scr { my ($ref) = @_; my $reftype = ref $ref; if( $reftype eq 'SCALAR') { $$ref = "$ref"; } elsif ( $reftype eq 'ARRAY') { for my $el (@$ref) { scr($el); } } elsif ( $reftype eq 'HASH') { while (my ($key,$val) = each %$ref ){ scr($val); } } else { ... # dunno yet } return $ref }
-*- mode: compilation; default-directory: "d:/exp/" -*- Compilation started at Thu Jul 23 22:28:14 C:/Perl_524/bin\perl.exe -w d:/exp/pm_is_deeply.pl ok 1 - is_deeply ok 2 - is_deeply ARRAY ok 3 - is_deeply HASH ok 4 - is_deeply HoA ok 5 - is_deeply HoA multiple refs not ok 6 - is_deeply # Failed test 'is_deeply' # at d:/exp/pm_is_deeply.pl line 28. # Structures begin differing at: # ${ $got} = 'SCALAR(0x26589e8)' # ${$expected} = 'SCALAR(0x2650480)' not ok 7 - is_deeply ARRAY # Failed test 'is_deeply ARRAY' # at d:/exp/pm_is_deeply.pl line 32. # Structures begin differing at: # ${ $got->[0]} = 'SCALAR(0x26589e8)' # ${$expected->[0]} = 'SCALAR(0x2650480)' not ok 8 - is_deeply HASH # Failed test 'is_deeply HASH' # at d:/exp/pm_is_deeply.pl line 36. # Structures begin differing at: # ${ $got->{t}} = 'SCALAR(0x26589e8)' # ${$expected->{t}} = 'SCALAR(0x2650480)' not ok 9 - is_deeply HoA # Failed test 'is_deeply HoA' # at d:/exp/pm_is_deeply.pl line 40. # Structures begin differing at: # ${ $got->{t}[0]} = 'SCALAR(0x26589e8)' # ${$expected->{t}[0]} = 'SCALAR(0x2650480)' not ok 10 - is_deeply HoA multiple refs # Failed test 'is_deeply HoA multiple refs' # at d:/exp/pm_is_deeply.pl line 44. # Structures begin differing at: # ${ $got->{t2}[0]} = 'SCALAR(0x26589e8)' # ${$expected->{t2}[0]} = 'SCALAR(0x2650480)' 1..10 # Looks like you failed 5 tests of 10. Compilation exited abnormally with code 5 at Thu Jul 23 22:28:14

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re: Test scalar refs (not values) in deeply nested structure (workaround) by LanX
in thread Test scalar refs (not values) in deeply nested structure by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.