File: 01-basics.t

package info (click to toggle)
libfunction-fallback-coreorpp-perl 0.090-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 156 kB
  • sloc: perl: 122; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 659 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!perl

use 5.010;
use strict;
use warnings;

use Function::Fallback::CoreOrPP qw(clone unbless uniq);
use Test::More 0.98;

subtest "unbless" => sub {
    local $Function::Fallback::CoreOrPP::USE_NONCORE_XS_FIRST = 0;
    is_deeply(unbless(bless({}, "x")), {}, 'hash ref');
    is_deeply(unbless(bless([], "x")), [], 'array ref');
    is_deeply(unbless(bless(\( my $scalar = 1 ), "x")), \1, 'scalar ref');
    is_deeply(unbless(bless(sub { 42 }, "x"))->(), 42, "code ref");
};

subtest "uniq" => sub {
    local $Function::Fallback::CoreOrPP::USE_NONCORE_XS_FIRST = 0;
    is_deeply([uniq(1, 3, 2, 1, 3, 4)], [1, 3, 2, 4]);
};

DONE_TESTING:
done_testing();