File: guess_syntax.t

package info (click to toggle)
libconfig-simple-perl 4.59-7
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 336 kB
  • sloc: perl: 659; makefile: 8
file content (38 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download | duplicates (5)
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
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 1.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use strict;
use FindBin ('$RealBin');
use Test::More ('no_plan');
use File::Spec;

BEGIN { 
    use_ok('Config::Simple');
}

my %files   = (
    'guess_syntax.cfg'      => 'simple',
    'bug.cfg'               => 'ini',
    'project.ini'           => 'ini',
    'simple.cfg'            => 'simple',
    'simplified.ini'        => 'ini'
);

while (my ($file, $syntax) = each %files ) {
    my $full_path = File::Spec->catfile($RealBin, $file);
    ok(my $config = Config::Simple->new( $full_path ), "read(): $full_path" );
    ok( $config->syntax eq $syntax, "guess_syntax(): $file  => '$syntax'");
}


my $config = Config::Simple->new( File::Spec->catfile($RealBin, 'simplified.ini') );
ok($config->syntax eq 'ini');
ok($config->{_SUB_SYNTAX} eq 'simple-ini' );