summaryrefslogtreecommitdiff
path: root/t/global-api.t
blob: 5932ef91a4f968911762484f2841785379ce047e (plain)
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
31
32
use strict;
use lib -e 't' ? 't' : 'test';
use lib 'inc';
use Test::YAML();
BEGIN {
    @Test::YAML::EXPORT =
        grep { not /^(Dump|Load)(File)?$/ } @Test::YAML::EXPORT;
}
use TestYAML tests => 4;
use YAML;

{
    no warnings qw'once redefine';
    require YAML::Dumper;

    local *YAML::Dumper::dump =
        sub { return 'got to dumper' };

    require YAML::Loader;
    local *YAML::Loader::load =
        sub { return 'got to loader' };

    is Dump(\%ENV), 'got to dumper',
        'Dump got to the business end';
    is Load(\%ENV), 'got to loader',
        'Load got to the business end';

    is Dump(\%ENV), 'got to dumper',
        'YAML::Dump got to the business end';
    is Load(\%ENV), 'got to loader',
        'YAML::Load got to the business end';
}