github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/runtime/import_test.go (about)

     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  // This file and importx_test.go make it possible to write tests in the runtime
     6  // package, which is generally more convenient for testing runtime internals.
     7  // For tests that mostly touch public APIs, it's generally easier to write them
     8  // in the runtime_test package and export any runtime internals via
     9  // export_test.go.
    10  //
    11  // There are a few limitations on runtime package tests that this bridges:
    12  //
    13  // 1. Tests use the signature "XTest<name>(t TestingT)". Since runtime can't import
    14  // testing, test functions can't use testing.T, so instead we have the T
    15  // interface, which *testing.T satisfies. And we start names with "XTest"
    16  // because otherwise go test will complain about Test functions with the wrong
    17  // signature. To actually expose these as test functions, this file contains
    18  // trivial wrappers.
    19  //
    20  // 2. Runtime package tests can't directly import other std packages, so we
    21  // inject any necessary functions from std.
    22  
    23  // TODO: Generate this
    24  
    25  package runtime_test