aboutsummaryrefslogtreecommitdiff
path: root/t/TestConfig.pm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-08-19 17:51:19 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2019-08-19 18:19:33 +0300
commit11e6beb1f44fb74dc11e79c3bda25aebfd80ae12 (patch)
treebef1bfcecd9ad587c582a79a8dac78ca5f7569b7 /t/TestConfig.pm
parentd417ed4a1875321b28c47ea5f6324479d1592309 (diff)
downloadconfig-parser-11e6beb1f44fb74dc11e79c3bda25aebfd80ae12.tar.gz
config-parser-11e6beb1f44fb74dc11e79c3bda25aebfd80ae12.tar.bz2
Improve constructor
This commit introduces the "mangle" method, which can be implemented by the caller in order to run any additional tree modifications after a successful parse and commit (see the new testcase for an example). * lib/Config/Parser.pm (new): Call the init method if lexicon hash has been loaded. (init,inited,commit): New methods. * t/ConfigSpec3.pm: New file. * t/TestConfig.pm: Don't attempt to load empty files. * t/conf08.t: New file.
Diffstat (limited to 't/TestConfig.pm')
-rw-r--r--t/TestConfig.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/t/TestConfig.pm b/t/TestConfig.pm
index bd4f3f5..08f5bae 100644
--- a/t/TestConfig.pm
+++ b/t/TestConfig.pm
@@ -47,9 +47,12 @@ sub new {
# FIXME: Filter out fh and line keywords?
my $self = $class->SUPER::new(%_);
$self->{_expected_errors} = $exp if $exp;
- $self->parse($file->filename);
- $self->{_status} = $self->commit;
-
+ if (-s $file->filename) {
+ $self->parse($file->filename);
+ $self->{_status} = $self->commit;
+ } else {
+ $self->{_status} = 1;
+ }
if ($exp && @{$self->{_expected_errors}}) {
$self->{_status} = 0;
$self->error("not all expected errors reported");

Return to:

Send suggestions and report system problems to the System administrator.