Skip to content

Commit

Permalink
[test] extra ASN.1 test instantiating with nil
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Apr 11, 2024
1 parent e1cdc0a commit 9b4bf31
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/ruby/test_asn1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def test_constants
assert_equal universal_tag_name, OpenSSL::ASN1::UNIVERSAL_TAG_NAME
end

require 'pp'

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

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

def test_simple_to_der
assert_equal "0\x00", OpenSSL::ASN1::Sequence.new(nil).to_der
assert_equal "1\x00", OpenSSL::ASN1::Set.new(nil).to_der
end

def test_constructive
oct = OpenSSL::ASN1::OctetString.new("")
assert_equal "\x04\x00", oct.to_der
Expand Down

0 comments on commit 9b4bf31

Please sign in to comment.