/[libconf]/libconf/perl-Libconf/test/nagios/nagios_test.pl
ViewVC logotype

Diff of /libconf/perl-Libconf/test/nagios/nagios_test.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by dams, Wed Dec 3 00:42:14 2003 UTC revision 1.4 by dams, Wed Dec 3 02:06:48 2003 UTC
# Line 12  $struct->writeConf("nagios_output_1"); Line 12  $struct->writeConf("nagios_output_1");
12  test(1);  test(1);
13  display(1);  display(1);
14    
15    # test 2, editing an atom
16    display(2);
17    $struct = new Libconf("hostgroups.cfg", 'nagios', '');
18    $struct->editAtom(-1, {key => 'members', list => [ 'test1', 'tutu' ] });
19    $struct->writeConf("nagios_output_2");
20    test(2);
21    
22    # test 3, appending an atom
23    display(3);
24    $struct = new Libconf("hostgroups.cfg", 'nagios', '');
25    $struct->appendAtom({section_name => 'section', type => 'SECTION', 'sections' => [] });
26    $struct->appendAtom({key => 'alias2', list => ['some', 'stuff'], type => 'KEY_LIST'});
27    $struct->appendAtom({type => 'ENDSECTION', 'sections' => [] });
28    $struct->writeConf("nagios_output_3");
29    test(3);
30    
31    # # test 4, inserting a atom
32    # display(4);
33    # $struct = new Libconf("hostgroups.cfg", 'nagios', '');
34    # Libconf::insertAtom($struct,
35    #                     ($struct->findAtomPos({type => 'KEY_LIST', key => 'alias', sections => [{name => 'hostgroups'}]}))+1,
36    #                     {key => 'TESTkey', list => [ 'TEST1', 'test2', 'test3'], type => 'KEY_LIST', sections => [{name => 'hostgroups'}]}
37    #                    );
38    # $struct->writeConf("nagios_output_4");
39    # test(4);
40    
41    # test 5, getting an atom
42    #display(5);
43    #$struct = new Libconf("hostgroups.cfg", 'nagios', '');
44    #my $a = $struct->getAtom(1);
45    #Libconf::output("smb.conf_output_5", Data::Dumper->Dump([$a],['getatom']) . "\n");
46    #test(5);
47    
48    # test 6, test for stable loop
49    display(6);
50    $struct = new Libconf("hostgroups.cfg", 'nagios', '');
51    $struct->writeConf("nagios_output_6");
52    $struct = new Libconf("nagios_output_6", 'nagios', '');
53    $struct->writeConf("nagios_output_6");
54    test(6);
55    
56    display(-1);
57    
58  sub display {  sub display {
59      local $| = 1;      local $| = 1;
60      $_[0] == -1 ? print " done\n" : print "\r   * testing nagios " . '.' x $_[0];      $_[0] == -1 ? print " done\n" : print "\r   * testing nagios " . '.' x $_[0];

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26