golang.org/x/tools/gopls@v0.15.3/internal/vulncheck/vulntest/stdlib_test.go (about)

     1  // Copyright 2022 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  //go:build go1.18
     6  // +build go1.18
     7  
     8  package vulntest
     9  
    10  import "testing"
    11  
    12  func TestMaybeStdlib(t *testing.T) {
    13  	for _, test := range []struct {
    14  		in   string
    15  		want bool
    16  	}{
    17  		{"", false},
    18  		{"math/crypto", true},
    19  		{"github.com/pkg/errors", false},
    20  		{"Path is unknown", false},
    21  	} {
    22  		got := maybeStdlib(test.in)
    23  		if got != test.want {
    24  			t.Errorf("%q: got %t, want %t", test.in, got, test.want)
    25  		}
    26  	}
    27  }