File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 55
66$:. unshift "lib"
77
8- require 'net/ldap '
8+ require 'net/snmp '
99require 'stringio'
1010
1111
1212class TestSnmp < Test ::Unit ::TestCase
1313
14+ SnmpRequest = "0'\002 \001 \000 \004 \006 public\240 \032 \002 \002 ?*\002 \001 \000 \002 \001 \000 0\016 0\f \006 \b +\006 \001 \002 \001 \001 \001 \000 \005 \000 "
15+
1416 def setup
1517 end
1618
1719 def teardown
1820 end
1921
22+ def test_invalid_packet
23+ data = "xxxx"
24+ assert_raise ( Net ::BER ::BerError ) {
25+ ary = data . read_ber ( Net ::SNMP ::AsnSyntax )
26+ }
27+
28+ end
29+
30+ def test_consume_string
31+ data = "xxx"
32+ assert_equal ( nil , data . read_ber! )
33+ assert_equal ( "xxx" , data )
34+
35+ data = SnmpRequest + "!!!"
36+ ary = data . read_ber! ( Net ::SNMP ::AsnSyntax )
37+ assert_equal ( "!!!" , data )
38+ assert ary . is_a? ( Array )
39+ assert ary . is_a? ( Net ::BER ::BerIdentifiedArray )
40+ end
41+
2042end
2143
2244
You can’t perform that action at this time.
0 commit comments