// Generated by Lisette bindgen
// Source: testing (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.24

import "go:context"
import "go:io"
import "go:time"

/// AllocsPerRun returns the average number of allocations during calls to f.
/// Although the return value has type float64, it will always be an integral value.
/// 
/// To compute the number of allocations, the function will first be run once as
/// a warm-up. The average number of allocations over the specified number of
/// runs will then be measured and returned.
/// 
/// AllocsPerRun sets [runtime.GOMAXPROCS] to 1 during its measurement and will restore
/// it before returning.
pub fn AllocsPerRun(runs: int, f: fn() -> ()) -> float64

pub fn Benchmark(f: fn(Ref<B>) -> ()) -> BenchmarkResult

/// CoverMode reports what the test coverage mode is set to. The
/// values are "set", "count", or "atomic". The return value will be
/// empty if test coverage is not enabled.
pub fn CoverMode() -> string

/// Coverage reports the current code coverage as a fraction in the range [0, 1].
/// If coverage is not enabled, Coverage returns 0.
/// 
/// When running a large set of sequential test cases, checking Coverage after each one
/// can be useful for identifying which test cases exercise new code paths.
/// It is not a replacement for the reports generated by 'go test -cover' and
/// 'go tool cover'.
pub fn Coverage() -> float64

/// Init registers testing flags. These flags are automatically registered by
/// the "go test" command before running test functions, so Init is only needed
/// when calling functions such as Benchmark without using "go test".
/// 
/// Init is not safe to call concurrently. It has no effect if it was already called.
pub fn Init()

/// Main is an internal function, part of the implementation of the "go test" command.
/// It was exported because it is cross-package and predates "internal" packages.
/// It is no longer used by "go test" but preserved, as much as possible, for other
/// systems that simulate "go test" using Main, but Main sometimes cannot be updated as
/// new functionality is added to the testing package.
/// Systems simulating "go test" should be updated to use [MainStart].
pub fn Main(
  matchString: fn(string, string) -> Result<bool, error>,
  tests: Slice<InternalTest>,
  benchmarks: Slice<InternalBenchmark>,
  examples: Slice<InternalExample>,
)

pub fn MainStart(
  deps: Unknown,
  tests: Slice<InternalTest>,
  benchmarks: Slice<InternalBenchmark>,
  fuzzTargets: Slice<InternalFuzzTarget>,
  examples: Slice<InternalExample>,
) -> Ref<M>

/// RegisterCover records the coverage data accumulators for the tests.
/// NOTE: This function is internal to the testing infrastructure and may change.
/// It is not covered (yet) by the Go 1 compatibility guidelines.
pub fn RegisterCover(c: Cover)

/// RunBenchmarks is an internal function but exported because it is cross-package;
/// it is part of the implementation of the "go test" command.
pub fn RunBenchmarks(
  matchString: fn(string, string) -> Result<bool, error>,
  benchmarks: Slice<InternalBenchmark>,
)

/// RunExamples is an internal function but exported because it is cross-package;
/// it is part of the implementation of the "go test" command.
pub fn RunExamples(
  matchString: fn(string, string) -> Result<bool, error>,
  examples: Slice<InternalExample>,
) -> bool

/// RunTests is an internal function but exported because it is cross-package;
/// it is part of the implementation of the "go test" command.
pub fn RunTests(
  matchString: fn(string, string) -> Result<bool, error>,
  tests: Slice<InternalTest>,
) -> bool

/// Short reports whether the -test.short flag is set.
pub fn Short() -> bool

/// Testing reports whether the current code is being run in a test.
/// This will report true in programs created by "go test",
/// false in programs created by "go build".
pub fn Testing() -> bool

/// Verbose reports whether the -test.v flag is set.
pub fn Verbose() -> bool

/// B is a type passed to [Benchmark] functions to manage benchmark
/// timing and control the number of iterations.
/// 
/// A benchmark ends when its Benchmark function returns or calls any of the methods
/// [B.FailNow], [B.Fatal], [B.Fatalf], [B.SkipNow], [B.Skip], or [B.Skipf].
/// Those methods must be called only from the goroutine running the Benchmark function.
/// The other reporting methods, such as the variations of [B.Log] and [B.Error],
/// may be called simultaneously from multiple goroutines.
/// 
/// Like in tests, benchmark logs are accumulated during execution
/// and dumped to standard output when done. Unlike in tests, benchmark logs
/// are always printed, so as not to hide output whose existence may be
/// affecting benchmark results.
pub struct B {
  pub N: int,
}

/// BenchmarkResult contains the results of a benchmark run.
pub struct BenchmarkResult {
  pub N: int,
  pub T: time.Duration,
  pub Bytes: int64,
  pub MemAllocs: uint64,
  pub MemBytes: uint64,
  pub Extra: Map<string, float64>,
}

/// Cover records information about test coverage checking.
/// NOTE: This struct is internal to the testing infrastructure and may change.
/// It is not covered (yet) by the Go 1 compatibility guidelines.
pub struct Cover {
  pub Mode: string,
  pub Counters: Map<string, Slice<uint32>>,
  pub Blocks: Map<string, Slice<CoverBlock>>,
  pub CoveredPackages: string,
}

/// CoverBlock records the coverage data for a single basic block.
/// The fields are 1-indexed, as in an editor: The opening line of
/// the file is number 1, for example. Columns are measured
/// in bytes.
/// NOTE: This struct is internal to the testing infrastructure and may change.
/// It is not covered (yet) by the Go 1 compatibility guidelines.
pub struct CoverBlock {
  pub Line0: uint32,
  pub Col0: uint16,
  pub Line1: uint32,
  pub Col1: uint16,
  pub Stmts: uint16,
}

/// F is a type passed to fuzz tests.
/// 
/// Fuzz tests run generated inputs against a provided fuzz target, which can
/// find and report potential bugs in the code being tested.
/// 
/// A fuzz test runs the seed corpus by default, which includes entries provided
/// by [F.Add] and entries in the testdata/fuzz/<FuzzTestName> directory. After
/// any necessary setup and calls to [F.Add], the fuzz test must then call
/// [F.Fuzz] to provide the fuzz target. See the testing package documentation
/// for an example, and see the [F.Fuzz] and [F.Add] method documentation for
/// details.
/// 
/// *F methods can only be called before [F.Fuzz]. Once the test is
/// executing the fuzz target, only [*T] methods can be used. The only *F methods
/// that are allowed in the [F.Fuzz] function are [F.Failed] and [F.Name].
pub type F

/// InternalBenchmark is an internal type but exported because it is cross-package;
/// it is part of the implementation of the "go test" command.
pub struct InternalBenchmark {
  pub Name: string,
  pub F: Option<fn(Ref<B>) -> ()>,
}

pub struct InternalExample {
  pub Name: string,
  pub F: Option<fn() -> ()>,
  pub Output: string,
  pub Unordered: bool,
}

/// InternalFuzzTarget is an internal type but exported because it is
/// cross-package; it is part of the implementation of the "go test" command.
pub struct InternalFuzzTarget {
  pub Name: string,
  pub Fn: Option<fn(Ref<F>) -> ()>,
}

/// InternalTest is an internal type but exported because it is cross-package;
/// it is part of the implementation of the "go test" command.
pub struct InternalTest {
  pub Name: string,
  pub F: Option<fn(Ref<T>) -> ()>,
}

/// M is a type passed to a TestMain function to run the actual tests.
pub type M

/// A PB is used by RunParallel for running parallel benchmarks.
pub type PB

/// T is a type passed to Test functions to manage test state and support formatted test logs.
/// 
/// A test ends when its Test function returns or calls any of the methods
/// [T.FailNow], [T.Fatal], [T.Fatalf], [T.SkipNow], [T.Skip], or [T.Skipf]. Those methods, as well as
/// the [T.Parallel] method, must be called only from the goroutine running the
/// Test function.
/// 
/// The other reporting methods, such as the variations of [T.Log] and [T.Error],
/// may be called simultaneously from multiple goroutines.
pub type T

/// TB is the interface common to [T], [B], and [F].
pub interface TB {
  fn Attr(key: string, value: string)
  fn Chdir(dir: string)
  fn Cleanup(arg0: fn() -> ())
  fn Context() -> context.Context
  fn Error(args: VarArgs<Unknown>)
  fn Errorf(format: string, args: VarArgs<Unknown>)
  fn Fail()
  fn FailNow()
  fn Failed() -> bool
  fn Fatal(args: VarArgs<Unknown>)
  fn Fatalf(format: string, args: VarArgs<Unknown>)
  fn Helper()
  fn Log(args: VarArgs<Unknown>)
  fn Logf(format: string, args: VarArgs<Unknown>)
  fn Name() -> string
  fn Output() -> io.Writer
  fn Setenv(key: string, value: string)
  fn Skip(args: VarArgs<Unknown>)
  fn SkipNow()
  fn Skipf(format: string, args: VarArgs<Unknown>)
  fn Skipped() -> bool
  fn TempDir() -> string
}

impl B {
  /// Attr emits a test attribute associated with this test.
  /// 
  /// The key must not contain whitespace.
  /// The value must not contain newlines or carriage returns.
  /// 
  /// The meaning of different attribute keys is left up to
  /// continuous integration systems and test frameworks.
  /// 
  /// Test attributes are emitted immediately in the test log,
  /// but they are intended to be treated as unordered.
  fn Attr(self: Ref<B>, key: string, value: string)

  /// Chdir calls [os.Chdir] and uses Cleanup to restore the current
  /// working directory to its original value after the test. On Unix, it
  /// also sets PWD environment variable for the duration of the test.
  /// 
  /// Because Chdir affects the whole process, it cannot be used
  /// in parallel tests or tests with parallel ancestors.
  fn Chdir(self: Ref<B>, dir: string)

  /// Cleanup registers a function to be called when the test (or subtest) and all its
  /// subtests complete. Cleanup functions will be called in last added,
  /// first called order.
  fn Cleanup(self: Ref<B>, f: fn() -> ())

  /// Context returns a context that is canceled just before
  /// Cleanup-registered functions are called.
  /// 
  /// Cleanup functions can wait for any resources
  /// that shut down on [context.Context.Done] before the test or benchmark completes.
  fn Context(self: Ref<B>) -> context.Context

  /// Elapsed returns the measured elapsed time of the benchmark.
  /// The duration reported by Elapsed matches the one measured by
  /// [B.StartTimer], [B.StopTimer], and [B.ResetTimer].
  fn Elapsed(self: Ref<B>) -> time.Duration

  /// Error is equivalent to Log followed by Fail.
  fn Error(self: Ref<B>, args: VarArgs<Unknown>)

  /// Errorf is equivalent to Logf followed by Fail.
  fn Errorf(self: Ref<B>, format: string, args: VarArgs<Unknown>)

  /// Fail marks the function as having failed but continues execution.
  fn Fail(self: Ref<B>)

  /// FailNow marks the function as having failed and stops its execution
  /// by calling [runtime.Goexit] (which then runs all deferred calls in the
  /// current goroutine).
  /// Execution will continue at the next test or benchmark.
  /// FailNow must be called from the goroutine running the
  /// test or benchmark function, not from other goroutines
  /// created during the test. Calling FailNow does not stop
  /// those other goroutines.
  fn FailNow(self: Ref<B>)

  /// Failed reports whether the function has failed.
  fn Failed(self: Ref<B>) -> bool

  /// Fatal is equivalent to Log followed by FailNow.
  fn Fatal(self: Ref<B>, args: VarArgs<Unknown>)

  /// Fatalf is equivalent to Logf followed by FailNow.
  fn Fatalf(self: Ref<B>, format: string, args: VarArgs<Unknown>)

  /// Helper marks the calling function as a test helper function.
  /// When printing file and line information, that function will be skipped.
  /// Helper may be called simultaneously from multiple goroutines.
  fn Helper(self: Ref<B>)

  /// Log formats its arguments using default formatting, analogous to [fmt.Println],
  /// and records the text in the error log. For tests, the text will be printed only if
  /// the test fails or the -test.v flag is set. For benchmarks, the text is always
  /// printed to avoid having performance depend on the value of the -test.v flag.
  /// It is an error to call Log after a test or benchmark returns.
  fn Log(self: Ref<B>, args: VarArgs<Unknown>)

  /// Logf formats its arguments according to the format, analogous to [fmt.Printf], and
  /// records the text in the error log. A final newline is added if not provided. For
  /// tests, the text will be printed only if the test fails or the -test.v flag is
  /// set. For benchmarks, the text is always printed to avoid having performance
  /// depend on the value of the -test.v flag.
  /// It is an error to call Logf after a test or benchmark returns.
  fn Logf(self: Ref<B>, format: string, args: VarArgs<Unknown>)

  /// Loop returns true as long as the benchmark should continue running.
  /// 
  /// A typical benchmark is structured like:
  /// 
  /// 	func Benchmark(b *testing.B) {
  /// 		... setup ...
  /// 		for b.Loop() {
  /// 			... code to measure ...
  /// 		}
  /// 		... cleanup ...
  /// 	}
  /// 
  /// Loop resets the benchmark timer the first time it is called in a benchmark,
  /// so any setup performed prior to starting the benchmark loop does not count
  /// toward the benchmark measurement. Likewise, when it returns false, it stops
  /// the timer so cleanup code is not measured.
  /// 
  /// Within the body of a "for b.Loop() { ... }" loop, arguments to and
  /// results from function calls within the loop are kept alive, preventing
  /// the compiler from fully optimizing away the loop body. Currently, this is
  /// implemented by disabling inlining of functions called in a b.Loop loop.
  /// This applies only to calls syntactically between the curly braces of the loop,
  /// and the loop condition must be written exactly as "b.Loop()". Optimizations
  /// are performed as usual in any functions called by the loop.
  /// 
  /// After Loop returns false, b.N contains the total number of iterations that
  /// ran, so the benchmark may use b.N to compute other average metrics.
  /// 
  /// Prior to the introduction of Loop, benchmarks were expected to contain an
  /// explicit loop from 0 to b.N. Benchmarks should either use Loop or contain a
  /// loop to b.N, but not both. Loop offers more automatic management of the
  /// benchmark timer, and runs each benchmark function only once per measurement,
  /// whereas b.N-based benchmarks must run the benchmark function (and any
  /// associated setup and cleanup) several times.
  fn Loop(self: Ref<B>) -> bool

  /// Name returns the name of the running (sub-) test or benchmark.
  /// 
  /// The name will include the name of the test along with the names of
  /// any nested sub-tests. If two sibling sub-tests have the same name,
  /// Name will append a suffix to guarantee the returned name is unique.
  fn Name(self: Ref<B>) -> string

  /// Output returns a Writer that writes to the same test output stream as TB.Log.
  /// The output is indented like TB.Log lines, but Output does not
  /// add source locations or newlines. The output is internally line
  /// buffered, and a call to TB.Log or the end of the test will implicitly
  /// flush the buffer, followed by a newline. After a test function and all its
  /// parents return, neither Output nor the Write method may be called.
  fn Output(self: Ref<B>) -> io.Writer

  /// ReportAllocs enables malloc statistics for this benchmark.
  /// It is equivalent to setting -test.benchmem, but it only affects the
  /// benchmark function that calls ReportAllocs.
  fn ReportAllocs(self: Ref<B>)

  /// ReportMetric adds "n unit" to the reported benchmark results.
  /// If the metric is per-iteration, the caller should divide by b.N,
  /// and by convention units should end in "/op".
  /// ReportMetric overrides any previously reported value for the same unit.
  /// ReportMetric panics if unit is the empty string or if unit contains
  /// any whitespace.
  /// If unit is a unit normally reported by the benchmark framework itself
  /// (such as "allocs/op"), ReportMetric will override that metric.
  /// Setting "ns/op" to 0 will suppress that built-in metric.
  fn ReportMetric(self: Ref<B>, n: float64, unit: string)

  /// ResetTimer zeroes the elapsed benchmark time and memory allocation counters
  /// and deletes user-reported metrics.
  /// It does not affect whether the timer is running.
  fn ResetTimer(self: Ref<B>)

  /// Run benchmarks f as a subbenchmark with the given name. It reports
  /// whether there were any failures.
  /// 
  /// A subbenchmark is like any other benchmark. A benchmark that calls Run at
  /// least once will not be measured itself and will be called once with N=1.
  fn Run(self: Ref<B>, name: string, f: fn(Ref<B>) -> ()) -> bool

  /// RunParallel runs a benchmark in parallel.
  /// It creates multiple goroutines and distributes b.N iterations among them.
  /// The number of goroutines defaults to GOMAXPROCS. To increase parallelism for
  /// non-CPU-bound benchmarks, call [B.SetParallelism] before RunParallel.
  /// RunParallel is usually used with the go test -cpu flag.
  /// 
  /// The body function will be run in each goroutine. It should set up any
  /// goroutine-local state and then iterate until pb.Next returns false.
  /// It should not use the [B.StartTimer], [B.StopTimer], or [B.ResetTimer] functions,
  /// because they have global effect. It should also not call [B.Run].
  /// 
  /// RunParallel reports ns/op values as wall time for the benchmark as a whole,
  /// not the sum of wall time or CPU time over each parallel goroutine.
  fn RunParallel(self: Ref<B>, body: fn(Ref<PB>) -> ())

  /// SetBytes records the number of bytes processed in a single operation.
  /// If this is called, the benchmark will report ns/op and MB/s.
  fn SetBytes(self: Ref<B>, n: int64)

  /// SetParallelism sets the number of goroutines used by [B.RunParallel] to p*GOMAXPROCS.
  /// There is usually no need to call SetParallelism for CPU-bound benchmarks.
  /// If p is less than 1, this call will have no effect.
  fn SetParallelism(self: Ref<B>, p: int)

  /// Setenv calls [os.Setenv] and uses Cleanup to
  /// restore the environment variable to its original value
  /// after the test.
  /// 
  /// Because Setenv affects the whole process, it cannot be used
  /// in parallel tests or tests with parallel ancestors.
  fn Setenv(self: Ref<B>, key: string, value: string)

  /// Skip is equivalent to Log followed by SkipNow.
  fn Skip(self: Ref<B>, args: VarArgs<Unknown>)

  /// SkipNow marks the test as having been skipped and stops its execution
  /// by calling [runtime.Goexit].
  /// If a test fails (see Error, Errorf, Fail) and is then skipped,
  /// it is still considered to have failed.
  /// Execution will continue at the next test or benchmark. See also FailNow.
  /// SkipNow must be called from the goroutine running the test, not from
  /// other goroutines created during the test. Calling SkipNow does not stop
  /// those other goroutines.
  fn SkipNow(self: Ref<B>)

  /// Skipf is equivalent to Logf followed by SkipNow.
  fn Skipf(self: Ref<B>, format: string, args: VarArgs<Unknown>)

  /// Skipped reports whether the test was skipped.
  fn Skipped(self: Ref<B>) -> bool

  /// StartTimer starts timing a test. This function is called automatically
  /// before a benchmark starts, but it can also be used to resume timing after
  /// a call to [B.StopTimer].
  fn StartTimer(self: Ref<B>)

  /// StopTimer stops timing a test. This can be used to pause the timer
  /// while performing steps that you don't want to measure.
  fn StopTimer(self: Ref<B>)

  /// TempDir returns a temporary directory for the test to use.
  /// The directory is automatically removed when the test and
  /// all its subtests complete.
  /// Each subsequent call to TempDir returns a unique directory;
  /// if the directory creation fails, TempDir terminates the test by calling Fatal.
  fn TempDir(self: Ref<B>) -> string
}

impl BenchmarkResult {
  /// AllocedBytesPerOp returns the "B/op" metric,
  /// which is calculated as r.MemBytes / r.N.
  fn AllocedBytesPerOp(self) -> int64

  /// AllocsPerOp returns the "allocs/op" metric,
  /// which is calculated as r.MemAllocs / r.N.
  fn AllocsPerOp(self) -> int64

  /// MemString returns r.AllocedBytesPerOp and r.AllocsPerOp in the same format as 'go test'.
  fn MemString(self) -> string

  /// NsPerOp returns the "ns/op" metric.
  fn NsPerOp(self) -> int64

  /// String returns a summary of the benchmark results.
  /// It follows the benchmark result line format from
  /// https://golang.org/design/14313-benchmark-format, not including the
  /// benchmark name.
  /// Extra metrics override built-in metrics of the same name.
  /// String does not include allocs/op or B/op, since those are reported
  /// by [BenchmarkResult.MemString].
  fn String(self) -> string
}

impl F {
  /// Add will add the arguments to the seed corpus for the fuzz test. This will be
  /// a no-op if called after or within the fuzz target, and args must match the
  /// arguments for the fuzz target.
  fn Add(self: Ref<F>, args: VarArgs<Unknown>)

  /// Attr emits a test attribute associated with this test.
  /// 
  /// The key must not contain whitespace.
  /// The value must not contain newlines or carriage returns.
  /// 
  /// The meaning of different attribute keys is left up to
  /// continuous integration systems and test frameworks.
  /// 
  /// Test attributes are emitted immediately in the test log,
  /// but they are intended to be treated as unordered.
  fn Attr(self: Ref<F>, key: string, value: string)

  /// Chdir calls [os.Chdir] and uses Cleanup to restore the current
  /// working directory to its original value after the test. On Unix, it
  /// also sets PWD environment variable for the duration of the test.
  /// 
  /// Because Chdir affects the whole process, it cannot be used
  /// in parallel tests or tests with parallel ancestors.
  fn Chdir(self: Ref<F>, dir: string)

  /// Cleanup registers a function to be called when the test (or subtest) and all its
  /// subtests complete. Cleanup functions will be called in last added,
  /// first called order.
  fn Cleanup(self: Ref<F>, f: fn() -> ())

  /// Context returns a context that is canceled just before
  /// Cleanup-registered functions are called.
  /// 
  /// Cleanup functions can wait for any resources
  /// that shut down on [context.Context.Done] before the test or benchmark completes.
  fn Context(self: Ref<F>) -> context.Context

  /// Error is equivalent to Log followed by Fail.
  fn Error(self: Ref<F>, args: VarArgs<Unknown>)

  /// Errorf is equivalent to Logf followed by Fail.
  fn Errorf(self: Ref<F>, format: string, args: VarArgs<Unknown>)

  /// Fail marks the function as having failed but continues execution.
  fn Fail(self: Ref<F>)

  /// FailNow marks the function as having failed and stops its execution
  /// by calling [runtime.Goexit] (which then runs all deferred calls in the
  /// current goroutine).
  /// Execution will continue at the next test or benchmark.
  /// FailNow must be called from the goroutine running the
  /// test or benchmark function, not from other goroutines
  /// created during the test. Calling FailNow does not stop
  /// those other goroutines.
  fn FailNow(self: Ref<F>)

  /// Failed reports whether the function has failed.
  fn Failed(self: Ref<F>) -> bool

  /// Fatal is equivalent to Log followed by FailNow.
  fn Fatal(self: Ref<F>, args: VarArgs<Unknown>)

  /// Fatalf is equivalent to Logf followed by FailNow.
  fn Fatalf(self: Ref<F>, format: string, args: VarArgs<Unknown>)

  /// Fuzz runs the fuzz function, ff, for fuzz testing. If ff fails for a set of
  /// arguments, those arguments will be added to the seed corpus.
  /// 
  /// ff must be a function with no return value whose first argument is [*T] and
  /// whose remaining arguments are the types to be fuzzed.
  /// For example:
  /// 
  /// 	f.Fuzz(func(t *testing.T, b []byte, i int) { ... })
  /// 
  /// The following types are allowed: []byte, string, bool, byte, rune, float32,
  /// float64, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64.
  /// More types may be supported in the future.
  /// 
  /// ff must not call any [*F] methods, e.g. [F.Log], [F.Error], [F.Skip]. Use
  /// the corresponding [*T] method instead. The only [*F] methods that are allowed in
  /// the F.Fuzz function are [F.Failed] and [F.Name].
  /// 
  /// This function should be fast and deterministic, and its behavior should not
  /// depend on shared state. No mutable input arguments, or pointers to them,
  /// should be retained between executions of the fuzz function, as the memory
  /// backing them may be mutated during a subsequent invocation. ff must not
  /// modify the underlying data of the arguments provided by the fuzzing engine.
  /// 
  /// When fuzzing, F.Fuzz does not return until a problem is found, time runs out
  /// (set with -fuzztime), or the test process is interrupted by a signal. F.Fuzz
  /// should be called exactly once, unless [F.Skip] or [F.Fail] is called beforehand.
  fn Fuzz(self: Ref<F>, ff: Unknown)

  /// Helper marks the calling function as a test helper function.
  /// When printing file and line information, that function will be skipped.
  /// Helper may be called simultaneously from multiple goroutines.
  fn Helper(self: Ref<F>)

  /// Log formats its arguments using default formatting, analogous to [fmt.Println],
  /// and records the text in the error log. For tests, the text will be printed only if
  /// the test fails or the -test.v flag is set. For benchmarks, the text is always
  /// printed to avoid having performance depend on the value of the -test.v flag.
  /// It is an error to call Log after a test or benchmark returns.
  fn Log(self: Ref<F>, args: VarArgs<Unknown>)

  /// Logf formats its arguments according to the format, analogous to [fmt.Printf], and
  /// records the text in the error log. A final newline is added if not provided. For
  /// tests, the text will be printed only if the test fails or the -test.v flag is
  /// set. For benchmarks, the text is always printed to avoid having performance
  /// depend on the value of the -test.v flag.
  /// It is an error to call Logf after a test or benchmark returns.
  fn Logf(self: Ref<F>, format: string, args: VarArgs<Unknown>)

  /// Name returns the name of the running (sub-) test or benchmark.
  /// 
  /// The name will include the name of the test along with the names of
  /// any nested sub-tests. If two sibling sub-tests have the same name,
  /// Name will append a suffix to guarantee the returned name is unique.
  fn Name(self: Ref<F>) -> string

  /// Output returns a Writer that writes to the same test output stream as TB.Log.
  /// The output is indented like TB.Log lines, but Output does not
  /// add source locations or newlines. The output is internally line
  /// buffered, and a call to TB.Log or the end of the test will implicitly
  /// flush the buffer, followed by a newline. After a test function and all its
  /// parents return, neither Output nor the Write method may be called.
  fn Output(self: Ref<F>) -> io.Writer

  /// Setenv calls [os.Setenv] and uses Cleanup to
  /// restore the environment variable to its original value
  /// after the test.
  /// 
  /// Because Setenv affects the whole process, it cannot be used
  /// in parallel tests or tests with parallel ancestors.
  fn Setenv(self: Ref<F>, key: string, value: string)

  /// Skip is equivalent to Log followed by SkipNow.
  fn Skip(self: Ref<F>, args: VarArgs<Unknown>)

  /// SkipNow marks the test as having been skipped and stops its execution
  /// by calling [runtime.Goexit].
  /// If a test fails (see Error, Errorf, Fail) and is then skipped,
  /// it is still considered to have failed.
  /// Execution will continue at the next test or benchmark. See also FailNow.
  /// SkipNow must be called from the goroutine running the test, not from
  /// other goroutines created during the test. Calling SkipNow does not stop
  /// those other goroutines.
  fn SkipNow(self: Ref<F>)

  /// Skipf is equivalent to Logf followed by SkipNow.
  fn Skipf(self: Ref<F>, format: string, args: VarArgs<Unknown>)

  /// Skipped reports whether the test was skipped.
  fn Skipped(self: Ref<F>) -> bool

  /// TempDir returns a temporary directory for the test to use.
  /// The directory is automatically removed when the test and
  /// all its subtests complete.
  /// Each subsequent call to TempDir returns a unique directory;
  /// if the directory creation fails, TempDir terminates the test by calling Fatal.
  fn TempDir(self: Ref<F>) -> string
}

impl M {
  /// Run runs the tests. It returns an exit code to pass to os.Exit.
  /// The exit code is zero when all tests pass, and non-zero for any kind
  /// of failure. For machine readable test results, parse the output of
  /// 'go test -json'.
  fn Run(self: Ref<M>) -> int
}

impl PB {
  /// Next reports whether there are more iterations to execute.
  fn Next(self: Ref<PB>) -> bool
}

impl T {
  /// Attr emits a test attribute associated with this test.
  /// 
  /// The key must not contain whitespace.
  /// The value must not contain newlines or carriage returns.
  /// 
  /// The meaning of different attribute keys is left up to
  /// continuous integration systems and test frameworks.
  /// 
  /// Test attributes are emitted immediately in the test log,
  /// but they are intended to be treated as unordered.
  fn Attr(self: Ref<T>, key: string, value: string)

  /// Chdir calls [os.Chdir] and uses Cleanup to restore the current
  /// working directory to its original value after the test. On Unix, it
  /// also sets PWD environment variable for the duration of the test.
  /// 
  /// Because Chdir affects the whole process, it cannot be used
  /// in parallel tests or tests with parallel ancestors.
  fn Chdir(self: Ref<T>, dir: string)

  /// Cleanup registers a function to be called when the test (or subtest) and all its
  /// subtests complete. Cleanup functions will be called in last added,
  /// first called order.
  fn Cleanup(self: Ref<T>, f: fn() -> ())

  /// Context returns a context that is canceled just before
  /// Cleanup-registered functions are called.
  /// 
  /// Cleanup functions can wait for any resources
  /// that shut down on [context.Context.Done] before the test or benchmark completes.
  fn Context(self: Ref<T>) -> context.Context

  /// Deadline reports the time at which the test binary will have
  /// exceeded the timeout specified by the -timeout flag.
  /// 
  /// The ok result is false if the -timeout flag indicates “no timeout” (0).
  fn Deadline(self: Ref<T>) -> Option<time.Time>

  /// Error is equivalent to Log followed by Fail.
  fn Error(self: Ref<T>, args: VarArgs<Unknown>)

  /// Errorf is equivalent to Logf followed by Fail.
  fn Errorf(self: Ref<T>, format: string, args: VarArgs<Unknown>)

  /// Fail marks the function as having failed but continues execution.
  fn Fail(self: Ref<T>)

  /// FailNow marks the function as having failed and stops its execution
  /// by calling [runtime.Goexit] (which then runs all deferred calls in the
  /// current goroutine).
  /// Execution will continue at the next test or benchmark.
  /// FailNow must be called from the goroutine running the
  /// test or benchmark function, not from other goroutines
  /// created during the test. Calling FailNow does not stop
  /// those other goroutines.
  fn FailNow(self: Ref<T>)

  /// Failed reports whether the function has failed.
  fn Failed(self: Ref<T>) -> bool

  /// Fatal is equivalent to Log followed by FailNow.
  fn Fatal(self: Ref<T>, args: VarArgs<Unknown>)

  /// Fatalf is equivalent to Logf followed by FailNow.
  fn Fatalf(self: Ref<T>, format: string, args: VarArgs<Unknown>)

  /// Helper marks the calling function as a test helper function.
  /// When printing file and line information, that function will be skipped.
  /// Helper may be called simultaneously from multiple goroutines.
  fn Helper(self: Ref<T>)

  /// Log formats its arguments using default formatting, analogous to [fmt.Println],
  /// and records the text in the error log. For tests, the text will be printed only if
  /// the test fails or the -test.v flag is set. For benchmarks, the text is always
  /// printed to avoid having performance depend on the value of the -test.v flag.
  /// It is an error to call Log after a test or benchmark returns.
  fn Log(self: Ref<T>, args: VarArgs<Unknown>)

  /// Logf formats its arguments according to the format, analogous to [fmt.Printf], and
  /// records the text in the error log. A final newline is added if not provided. For
  /// tests, the text will be printed only if the test fails or the -test.v flag is
  /// set. For benchmarks, the text is always printed to avoid having performance
  /// depend on the value of the -test.v flag.
  /// It is an error to call Logf after a test or benchmark returns.
  fn Logf(self: Ref<T>, format: string, args: VarArgs<Unknown>)

  /// Name returns the name of the running (sub-) test or benchmark.
  /// 
  /// The name will include the name of the test along with the names of
  /// any nested sub-tests. If two sibling sub-tests have the same name,
  /// Name will append a suffix to guarantee the returned name is unique.
  fn Name(self: Ref<T>) -> string

  /// Output returns a Writer that writes to the same test output stream as TB.Log.
  /// The output is indented like TB.Log lines, but Output does not
  /// add source locations or newlines. The output is internally line
  /// buffered, and a call to TB.Log or the end of the test will implicitly
  /// flush the buffer, followed by a newline. After a test function and all its
  /// parents return, neither Output nor the Write method may be called.
  fn Output(self: Ref<T>) -> io.Writer

  /// Parallel signals that this test is to be run in parallel with (and only with)
  /// other parallel tests. When a test is run multiple times due to use of
  /// -test.count or -test.cpu, multiple instances of a single test never run in
  /// parallel with each other.
  fn Parallel(self: Ref<T>)

  /// Run runs f as a subtest of t called name. It runs f in a separate goroutine
  /// and blocks until f returns or calls t.Parallel to become a parallel test.
  /// Run reports whether f succeeded (or at least did not fail before calling t.Parallel).
  /// 
  /// Run may be called simultaneously from multiple goroutines, but all such calls
  /// must return before the outer test function for t returns.
  fn Run(self: Ref<T>, name: string, f: fn(Ref<T>) -> ()) -> bool

  /// Setenv calls os.Setenv(key, value) and uses Cleanup to
  /// restore the environment variable to its original value
  /// after the test.
  /// 
  /// Because Setenv affects the whole process, it cannot be used
  /// in parallel tests or tests with parallel ancestors.
  fn Setenv(self: Ref<T>, key: string, value: string)

  /// Skip is equivalent to Log followed by SkipNow.
  fn Skip(self: Ref<T>, args: VarArgs<Unknown>)

  /// SkipNow marks the test as having been skipped and stops its execution
  /// by calling [runtime.Goexit].
  /// If a test fails (see Error, Errorf, Fail) and is then skipped,
  /// it is still considered to have failed.
  /// Execution will continue at the next test or benchmark. See also FailNow.
  /// SkipNow must be called from the goroutine running the test, not from
  /// other goroutines created during the test. Calling SkipNow does not stop
  /// those other goroutines.
  fn SkipNow(self: Ref<T>)

  /// Skipf is equivalent to Logf followed by SkipNow.
  fn Skipf(self: Ref<T>, format: string, args: VarArgs<Unknown>)

  /// Skipped reports whether the test was skipped.
  fn Skipped(self: Ref<T>) -> bool

  /// TempDir returns a temporary directory for the test to use.
  /// The directory is automatically removed when the test and
  /// all its subtests complete.
  /// Each subsequent call to TempDir returns a unique directory;
  /// if the directory creation fails, TempDir terminates the test by calling Fatal.
  fn TempDir(self: Ref<T>) -> string
}
