File: underscore.t

package info (click to toggle)
libsnmp-mib-compiler-perl 0.06-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,036 kB
  • sloc: perl: 2,656; makefile: 7
file content (47 lines) | stat: -rw-r--r-- 910 bytes parent folder | download | duplicates (6)
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
# -*- mode: Perl -*-

BEGIN { unshift @INC, "lib" }
use strict;
use FileHandle;
use SNMP::MIB::Compiler;
use Data::Compare;

local $^W = 1;
$| = 1;

print "1..1\n";
my $t = 1;

my $mib = new SNMP::MIB::Compiler();
$mib->{'filename'} = '<DATA>';
$mib->{'debug_lexer'} = 0;
$mib->{'allow_underscore'} = 1;

# create a stream to the pseudo MIB file
my $s = Stream->new(*DATA);
$mib->{'stream'} = $s;
$mib->parse_Module;

my $good = { 1 => 'noUnderscore', 2 => 'with_underscore' };

print Compare($mib->{'nodes'}{'underScore'}{'syntax'}{'values'},
	      $good) ? "" : "not ", "ok ", $t++, "\n";

# end

__DATA__

UNDERSCORE-MIB DEFINITIONS ::= BEGIN

 underScore OBJECT-TYPE
        SYNTAX  INTEGER {
                     noUnderscore(1),
                     with_underscore(2)
                }
        ACCESS read-only
        STATUS mandatory
        DESCRIPTION
             " "
        ::= { under 1 }

END