summaryrefslogtreecommitdiff
path: root/libgo/go/crypto/x509/verify_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/crypto/x509/verify_test.go')
-rw-r--r--libgo/go/crypto/x509/verify_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgo/go/crypto/x509/verify_test.go b/libgo/go/crypto/x509/verify_test.go
index df5443023ff..2016858307e 100644
--- a/libgo/go/crypto/x509/verify_test.go
+++ b/libgo/go/crypto/x509/verify_test.go
@@ -19,6 +19,7 @@ type verifyTest struct {
roots []string
currentTime int64
dnsName string
+ nilRoots bool
errorCallback func(*testing.T, int, error) bool
expectedChains [][]string
@@ -48,6 +49,14 @@ var verifyTests = []verifyTest{
{
leaf: googleLeaf,
intermediates: []string{thawteIntermediate},
+ nilRoots: true, // verifies that we don't crash
+ currentTime: 1302726541,
+ dnsName: "www.google.com",
+ errorCallback: expectAuthorityUnknown,
+ },
+ {
+ leaf: googleLeaf,
+ intermediates: []string{thawteIntermediate},
roots: []string{verisignRoot},
currentTime: 1,
dnsName: "www.example.com",
@@ -136,6 +145,9 @@ func TestVerify(t *testing.T) {
DNSName: test.dnsName,
CurrentTime: time.Unix(test.currentTime, 0),
}
+ if test.nilRoots {
+ opts.Roots = nil
+ }
for j, root := range test.roots {
ok := opts.Roots.AppendCertsFromPEM([]byte(root))