test_case_harness

package
v0.2.40 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 2 Imported by: 0

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