testassert

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: EUPL-1.2 Imports: 2 Imported by: 0

Documentation

Overview

Package testassert provides small assertion predicates shared by tests.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(container, elem any) bool

Contains reports whether container contains elem for strings, maps, arrays, or slices.

if !testassert.Contains(content, "workflow_call:") { t.Fatal("missing workflow call") }

Example
_ = Contains("agent", "agent")
core.Println("Contains")
Output:
Contains

func ElementsMatch

func ElementsMatch(want, got any) bool

ElementsMatch reports whether want and got contain the same elements, ignoring order.

if !testassert.ElementsMatch([]string{"linux", "darwin"}, targets) { t.Fatal("target mismatch") }

Example
_ = ElementsMatch("agent", "agent")
core.Println("ElementsMatch")
Output:
ElementsMatch

func Empty

func Empty(value any) bool

Empty reports whether value is nil, the zero value, or a zero-length container.

if testassert.Empty(artifacts) { t.Fatal("expected artifacts") }

Example
_ = Empty("agent")
core.Println("Empty")
Output:
Empty

func Equal

func Equal(want, got any) bool

Equal reports whether want and got are deeply equal.

if !testassert.Equal("go", builder.Name()) { t.Fatal("unexpected builder name") }

Example

--- v0.9.0 generated usage examples ---

_ = Equal("agent", "agent")
core.Println("Equal")
Output:
Equal

func Nil

func Nil(value any) bool

Nil reports whether value is nil, including typed nil interfaces.

if !testassert.Nil(err) { t.Fatalf("unexpected error: %v", err) }

Example
_ = Nil("agent")
core.Println("Nil")
Output:
Nil

func Zero

func Zero(value any) bool

Zero reports whether value is nil or the zero value for its type.

if !testassert.Zero(build.Config{}) { t.Fatal("expected zero config") }

Example
_ = Zero("agent")
core.Println("Zero")
Output:
Zero

Types

This section is empty.

Jump to

Keyboard shortcuts

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