~ubuntu-branches/ubuntu/natty/libconfig-inifiles-perl/natty

« back to all changes in this revision

Viewing changes to t/lib/Config/IniFiles/Debug.pm

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard, gregor herrmann
  • Date: 2009-01-24 22:25:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090124222526-uutu8jg5r4vrfljq
Tags: 2.47-1
[ Jonas Smedegaard ]
* New upstream release. Closes: bug#430426, #380280.
* Depend on ${misc:Depends}.
* Fix Vcs-* fields to point to refer to correct package.
* Update CDBS snippets:
  + Update copyright-check output to more closely match proposed new
    copyright file format
  + Simplify internal variables
  + Ignore no files by default in copyright-check.mk
  + Correct and update copyright hints of the snippets themselves
  + Move dependency cleanup to new local snippet package-relations.mk.
* Update debian/copyright and copyright hints:
  + Rewrite debian/copyright using new file format, version 428
  + Add info on CDBS snippets (new owners, no new licenses)
* Add DEB_MAINTAINER_MODE in debian/rules (thanks to Romain Beauxis).

[ gregor herrmann ]
* debian/watch: use dist-based URL.
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
  (source stanza).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use strict;
 
2
use warnings;
 
3
 
 
4
use Carp;
 
5
 
 
6
# Checks that the following relationships hold set-wise (e.g. ignoring order):
 
7
#
 
8
#  keys($self->{v}) = $self->{sects}
 
9
#
 
10
# And for every section $sect:
 
11
#
 
12
#  keys($self->{v}{sect}) = $self->{v}{params}
 
13
#
 
14
# This should be the case whenever control flows outside this module. Croaks
 
15
# upon any error.
 
16
sub Config::IniFiles::_assert_invariants {
 
17
        my ($self)=@_;
 
18
        my %set;
 
19
        foreach my $sect (@{$self->{sects}}) {
 
20
                croak "Non-lowercase section $sect" if ($self->{nocase} &&
 
21
                                                                                          (lc($sect) ne $sect));
 
22
                $set{$sect}++;
 
23
        }
 
24
        foreach my $sect (keys %{$self->{v}}) {
 
25
                croak "Key $sect in \$self->{v} and not in \$self->{sects}" unless
 
26
                  ($set{$sect}++);
 
27
        }
 
28
        grep { croak "Key $_ in \$self->{sects} and not in in \$self->{v}" unless
 
29
           $set{$_} eq 2 } (keys %set);
 
30
 
 
31
        foreach my $sect (@{$self->{sects}}) {
 
32
                %set=();
 
33
 
 
34
                foreach my $parm (@{$self->{parms}{$sect}}) {
 
35
                        croak "Non-lowercase parameter $parm" if ($self->{nocase} &&
 
36
                                                                                                        (lc($parm) ne $parm));
 
37
                        $set{$parm}++;
 
38
                }
 
39
                foreach my $parm (keys %{$self->{v}{$sect}}) {
 
40
                        croak "Key $parm in \$self->{v}{'$sect'} and not in \$self->{parms}{'$sect'}"
 
41
                          unless ($set{$parm}++);
 
42
                }
 
43
                grep { croak "Key $_ in \$self->{parms}{'$sect'} and not in in \$self->{v}{'$sect'}"
 
44
                                 unless $set{$_} eq 2 } (keys %set);
 
45
        }
 
46
}
 
47
 
 
48
1;
 
49