-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prove some calling restrictions for config_dirs and providers and test another misusage of _plug_dir_source. Signed-off-by: Jens Rehsack <sno@netbsd.org>
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; |