github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/crypto/x509/root_omit_test.go (about)

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build darwin,arm64 darwin,amd64,ios
     6  // +build x509omitbundledroots
     7  
     8  package x509
     9  
    10  import (
    11  	"strings"
    12  	"testing"
    13  )
    14  
    15  func TestOmitBundledRoots(t *testing.T) {
    16  	cp, err := loadSystemRoots()
    17  	if err == nil {
    18  		t.Fatalf("loadSystemRoots = (pool %p, error %v); want non-nil error", cp, err)
    19  	}
    20  	if !strings.Contains(err.Error(), "root bundling disabled") {
    21  		t.Errorf("unexpected error doesn't mention bundling: %v", err)
    22  	}
    23  }