Skip to content

Commit 9b4bf31

Browse files
committed
[test] extra ASN.1 test instantiating with nil
1 parent e1cdc0a commit 9b4bf31

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test/ruby/test_asn1.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ def test_constants
4545
assert_equal universal_tag_name, OpenSSL::ASN1::UNIVERSAL_TAG_NAME
4646
end
4747

48-
require 'pp'
49-
50-
def _test_parse_infinite_length_sequence # borrowed from Krypt
48+
def _test_parse_infinite_length_sequence; require 'pp' # borrowed from Krypt
5149
raw = [%w{30 80 04 01 01 02 01 01 00 00}.join("")].pack("H*")
5250
pp asn1 = OpenSSL::ASN1.decode(raw)
5351

@@ -66,6 +64,11 @@ def _test_parse_infinite_length_sequence # borrowed from Krypt
6664
assert_equal(raw, asn1.to_der)
6765
end
6866

67+
def test_simple_to_der
68+
assert_equal "0\x00", OpenSSL::ASN1::Sequence.new(nil).to_der
69+
assert_equal "1\x00", OpenSSL::ASN1::Set.new(nil).to_der
70+
end
71+
6972
def test_constructive
7073
oct = OpenSSL::ASN1::OctetString.new("")
7174
assert_equal "\x04\x00", oct.to_der

0 commit comments

Comments
 (0)