Debian Codegraph @

internal/bisect/bisect_test.go

raw symbols SCIP
1 // Copyright 2023 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 bisectscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/bisect`/
6
7 import (
8 "osscip-go gomod github.com/golang/go/src go1.25.0 os/"
9 "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/"
10 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
11 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
12 )
13
14 // In order for package bisect to be copied into the standard library
15 // and used by very low-level packages such as internal/godebug,
16 // it needs to have no imports at all.
17 func TestNoImportsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/bisect`/TestNoImports().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
18 files, err := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Globscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Glob().("*.go")
19 if err != nil {
20 t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err)
21 }
22 for _, file := range files {
23 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasSuffix().(file, "_test.go") {
24 continue
25 }
26 data, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25.0 os/ReadFile().(file)
27 if err != nil {
28 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().(err)
29 continue
30 }
31 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(string(data), "\nimport") {
32 t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%s contains imports; package bisect must not import other packages", file)
33 }
34 }
35 }