File: 05-scalar.t

package info (click to toggle)
libclone-choose-perl 0.010-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 320 kB
  • sloc: perl: 1,295; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use Scalar::Util qw(refaddr);
use Test::More;

BEGIN
{
    $ENV{CLONE_CHOOSE_PREFERRED_BACKEND} and eval "use $ENV{CLONE_CHOOSE_PREFERRED_BACKEND}; 1;";
    $@ and plan skip_all => "No $ENV{CLONE_CHOOSE_PREFERRED_BACKEND} found.";
}

use Clone::Choose;

my $string = "Scalar";
$string = \$string;
my $cloned_string = clone $string;

ok(refaddr $string != refaddr $cloned_string, "Scalar String");

my $numeric = 3.141;
$numeric = \$numeric;
my $cloned_numeric = clone $numeric;

ok(refaddr $numeric != refaddr $cloned_numeric, "Scalar Numeric");

my $undef = undef;
$undef = \$undef;
my $cloned_undef = clone $undef;

ok(refaddr $undef != refaddr $cloned_undef, "Scalar Undef");

done_testing;