1
0
mirror of https://github.com/golang/go synced 2024-11-24 00:20:14 -07:00

encoding/asn1: add test for private tag

This commit is contained in:
HAMANO Tsukasa 2018-05-02 14:53:45 +09:00
parent 36242fd51f
commit b3c69ad091

View File

@ -83,6 +83,8 @@ type applicationTest struct {
type privateTest struct { type privateTest struct {
A int `asn1:"private,tag:0"` A int `asn1:"private,tag:0"`
B int `asn1:"private,tag:1,explicit"` B int `asn1:"private,tag:1,explicit"`
C int `asn1:"private,tag:31"` // tag size should be 2 octet
D int `asn1:"private,tag:128"` // tag size should be 3 octet
} }
type numericStringTest struct { type numericStringTest struct {
@ -174,7 +176,7 @@ var marshalTests = []marshalTest{
{defaultTest{1}, "3000"}, {defaultTest{1}, "3000"},
{defaultTest{2}, "3003020102"}, {defaultTest{2}, "3003020102"},
{applicationTest{1, 2}, "30084001016103020102"}, {applicationTest{1, 2}, "30084001016103020102"},
{privateTest{1, 2}, "3008c00101e103020102"}, {privateTest{1, 2, 3, 4}, "3011c00101e103020102df1f0103df81000104"},
{numericStringTest{"1 9"}, "30051203312039"}, {numericStringTest{"1 9"}, "30051203312039"},
} }