testutil

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testutil holds helpers shared by tests in several packages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountPackageExtractionDirs

func CountPackageExtractionDirs(t *testing.T) int

CountPackageExtractionDirs counts package extraction directories in the system temp directory, so a test can check that a scan removed the one it created

func DynamicSystemBinary

func DynamicSystemBinary(t *testing.T) string

DynamicSystemBinary returns a dynamically linked system binary, which the scratch sandbox image cannot run because it has no ELF interpreter, or skips the test when the host has none

func WriteTree

func WriteTree(t *testing.T, files map[string]string) string

WriteTree writes files, keyed by path relative to the root, into a fresh temporary directory and returns that directory

Types

type CancelAfter

type CancelAfter struct {
	context.Context
	Limit int32
	// contains filtered or unexported fields
}

CancelAfter reports cancellation once Err has been called more than Limit times, so a test can stop work part way without depending on a clock

func (*CancelAfter) Err

func (c *CancelAfter) Err() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL