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 39 40 41 42 43 44 45 46 47
|
# This is a test of the config file parsing. There are certain options which should be there
# and others which should not.
use Test;
use Data::Dumper;
BEGIN {plan tests => 19;
@ARGV = qw(--quiet --cfgfile t/cfg/options.cfg);
}
eval {
use SCConfig;
return 1;
};
ok($@,'') or croak("No point in going any further");
# first, possitive tests
ok($config->maxkernel(), 10);
ok($config->root(),"/tmp/sctests");
ok($config->interface0_type(),"static");
ok($config->interface1_device(),"dummy1");
ok($config->kernel0_path(),"/boot/vmlinuz");
ok($config->kernel1_append(),"single");
ok($config->boot_vga(),"test");
ok($config->boot_extras(),"go team");
my %vars = $config->varlist("^interface.*type");
ok(scalar(keys %vars),4);
%vars = $config->varlist("^kernel.*path");
ok(scalar(keys %vars),10);
# now negative tests
ok(!$config->kernel00_path());
ok(!$config->kernel01_path());
ok(!$config->kernel3_badoption());
ok(!$config->kernel12_path());
ok(!$config->kernel103_path());
# now defined tests
ok(defined($config->kernel5_path()));
ok(!defined($config->kernel15_path()));
ok(!defined($config->kernel149_path()));
|