File: 18-open.t

package info (click to toggle)
libconfig-zomg-perl 1.000000-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 264 kB
  • sloc: perl: 352; makefile: 9; sh: 4
file content (44 lines) | stat: -rw-r--r-- 901 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use strict;
use warnings;

use Test::More;
use Test::Warn;

use Config::ZOMG;

sub has_Config_General {
    return eval "require Config::General;";
}

{
    my $config = Config::ZOMG->open( 't/assets/some_random_file.pl' );
    ok( $config );
    ok( keys %{ $config } );
}

{
    my $config = Config::ZOMG->open( qw{ name xyzzy path t/assets } );
    ok( $config );
    ok( keys %{ $config } );
}

{
    my $config = Config::ZOMG->open( 't/assets/missing-file.pl' );
    ok( ! $config );
}

{
    my $config = Config::ZOMG->new(
        file => 't/assets/some_random_file.pl'
    );
    warning_like { $config->open( '...' ) } qr/You called ->open on an instantiated object with arguments/;
}

{
    my ($config_hash, $config) = Config::ZOMG->open( qw{ name xyzzy path t/assets } );
    ok( $config_hash );
    is( ref $config_hash, 'HASH' );
    ok( $config->isa('Config::ZOMG') );
}

done_testing;