test_case_harness

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 2 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestCaseHarness

type TestCaseHarness struct {
	// Logger is to be used for all logs generated from the test function.
	Logger *logger.Logger

	// Executable is the program to be tested.
	Executable *executable.Executable
	// contains filtered or unexported fields
}

TestCaseHarness is passed to your TestCase's TestFunc.

If the program is a long-lived program that must be alive during the duration of the test (like a Redis server), do something like this at the start of your test function:

if err := harness.Executable.Start(); err != nil {
   return err
}
harness.RegisterTeardownFunc(func() { harness.Executable.Kill() })

If the program is a script that must be executed and then checked for output (like a Git command), use it like this:

result, err := harness.Executable.Run("cat-file", "-p", "sha")
if err != nil {
    return err
 }

func (*TestCaseHarness) NewExecutable

func (s *TestCaseHarness) NewExecutable() *executable.Executable

func (*TestCaseHarness) RegisterTeardownFunc

func (s *TestCaseHarness) RegisterTeardownFunc(teardownFunc func())

func (*TestCaseHarness) RunTeardownFuncs

func (s *TestCaseHarness) RunTeardownFuncs()

Jump to

Keyboard shortcuts

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