Skip to content

Commit b905606

Browse files
committed
Add unmarshal unit tests for extensions
Adds missing unmarshal unit tests for extensions that did not have them. These ensure that marshal / unmarshal is round-trippable. Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
1 parent 0736d45 commit b905606

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

pkg/protocol/extension/supported_elliptic_curves_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ func TestExtensionSupportedGroups(t *testing.T) {
2222
} else if !reflect.DeepEqual(raw, rawSupportedGroups) {
2323
t.Errorf("extensionSupportedGroups marshal: got %#v, want %#v", raw, rawSupportedGroups)
2424
}
25+
26+
roundtrip := &SupportedEllipticCurves{}
27+
if err := roundtrip.Unmarshal(raw); err != nil {
28+
t.Error(err)
29+
} else if !reflect.DeepEqual(roundtrip, parsedSupportedGroups) {
30+
t.Errorf("extensionSupportedGroups unmarshal: got %#v, want %#v", roundtrip, parsedSupportedGroups)
31+
}
2532
}

pkg/protocol/extension/supported_point_formats_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ func TestExtensionSupportedPointFormats(t *testing.T) {
2222
} else if !reflect.DeepEqual(raw, rawExtensionSupportedPointFormats) {
2323
t.Errorf("extensionSupportedPointFormats marshal: got %#v, want %#v", raw, rawExtensionSupportedPointFormats)
2424
}
25+
26+
roundtrip := &SupportedPointFormats{}
27+
if err := roundtrip.Unmarshal(raw); err != nil {
28+
t.Error(err)
29+
} else if !reflect.DeepEqual(roundtrip, parsedExtensionSupportedPointFormats) {
30+
t.Errorf("extensionSupportedPointFormats unmarshal: got %#v, want %#v", roundtrip, parsedExtensionSupportedPointFormats)
31+
}
2532
}

pkg/protocol/extension/supported_signature_algorithms_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ func TestExtensionSupportedSignatureAlgorithms(t *testing.T) {
3535
} else if !reflect.DeepEqual(raw, rawExtensionSupportedSignatureAlgorithms) {
3636
t.Errorf("extensionSupportedSignatureAlgorithms marshal: got %#v, want %#v", raw, rawExtensionSupportedSignatureAlgorithms)
3737
}
38+
39+
roundtrip := &SupportedSignatureAlgorithms{}
40+
if err := roundtrip.Unmarshal(raw); err != nil {
41+
t.Error(err)
42+
} else if !reflect.DeepEqual(roundtrip, parsedExtensionSupportedSignatureAlgorithms) {
43+
t.Errorf("extensionSupportedSignatureAlgorithms unmarshal: got %#v, want %#v", roundtrip, parsedExtensionSupportedSignatureAlgorithms)
44+
}
3845
}

0 commit comments

Comments
 (0)