summaryrefslogtreecommitdiff
path: root/src/pkg/asn1/asn1_test.go
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2010-01-11 18:53:58 -0800
committerAdam Langley <agl@golang.org>2010-01-11 18:53:58 -0800
commitaa26195a61879773d2335f64d9e818236dc5cc9f (patch)
treefc5b2f6317de77d0a68b237d98b26bf06cb95244 /src/pkg/asn1/asn1_test.go
parent0d3572a8e95be8d65b03268cbcbcefe536dfa97f (diff)
downloadgolang-aa26195a61879773d2335f64d9e818236dc5cc9f.tar.gz
asn1: fix parsing of elements after a string in a structure.
Fixes issue 516. R=rsc CC=golang-dev, golang-dev http://codereview.appspot.com/184080
Diffstat (limited to 'src/pkg/asn1/asn1_test.go')
-rw-r--r--src/pkg/asn1/asn1_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/asn1/asn1_test.go b/src/pkg/asn1/asn1_test.go
index 5071facfc..43c746895 100644
--- a/src/pkg/asn1/asn1_test.go
+++ b/src/pkg/asn1/asn1_test.go
@@ -263,6 +263,11 @@ type TestContextSpecificTags2 struct {
B int
}
+type TestElementsAfterString struct {
+ S string
+ A, B int
+}
+
var unmarshalTestData []unmarshalTest = []unmarshalTest{
unmarshalTest{[]byte{0x02, 0x01, 0x42}, newInt(0x42)},
unmarshalTest{[]byte{0x30, 0x08, 0x06, 0x06, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d}, &TestObjectIdentifierStruct{[]int{1, 2, 840, 113549}}},
@@ -277,6 +282,7 @@ var unmarshalTestData []unmarshalTest = []unmarshalTest{
unmarshalTest{[]byte{0x30, 0x08, 0xa1, 0x03, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02}, &TestContextSpecificTags2{1, 2}},
unmarshalTest{[]byte{0x01, 0x01, 0x00}, newBool(false)},
unmarshalTest{[]byte{0x01, 0x01, 0x01}, newBool(true)},
+ unmarshalTest{[]byte{0x30, 0x0b, 0x13, 0x03, 0x66, 0x6f, 0x6f, 0x02, 0x01, 0x22, 0x02, 0x01, 0x33}, &TestElementsAfterString{"foo", 0x22, 0x33}},
}
func TestUnmarshal(t *testing.T) {