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