File: 05-errors.t

package info (click to toggle)
libfile-configdir-perl 0.021-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 489; sh: 6; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 757 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
#!perl

use strict;
use warnings;

use Test::More;

use File::ConfigDir ();

foreach my $fn (
    qw(config_dirs system_cfg_dir desktop_cfg_dir),
    qw(core_cfg_dir site_cfg_dir vendor_cfg_dir),
    qw(local_cfg_dir here_cfg_dir vendorapp_cfg_dir),
    qw(xdg_config_home user_cfg_dir locallib_cfg_dir),
  )
{
    my $faddr = File::ConfigDir->can($fn);
    eval { $faddr->(qw(foo bar)); };
    my $exception = $@;
    like($exception, qr/$fn\(;\$\), not $fn\(\$,\$\)/, "$fn throws exception on misuse");
}

foreach my $fn (qw(singleapp_cfg_dir))
{
    my $faddr = File::ConfigDir->can($fn);
    eval { $faddr->(qw(foo bar)); };
    my $exception = $@;
    like($exception, qr/$fn\(\), not $fn\(\$,\$\)/, "$fn throws exception on misuse");
}

done_testing;