be_struct

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 6 Imported by: 0

README

be_struct

-- import "."

Usage

func HavingField
func HavingField[StructT any](fieldName string, expectedValue ...any) types.BeMatcher

HavingField succeeds if the actual value is a struct and it has a field with the given name. If an expected value is provided, it also succeeds if the actual value's field has the same value.

Example:

Expect(result).To(be_structs.HavingField[TestStruct]("Field1", "hello1"))
Expect(result).To(be_structs.HavingField[TestStruct]("Field2"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HavingField

func HavingField[StructT any](fieldName string, expectedValue ...any) types.BeMatcher

HavingField succeeds if the actual value is a struct and it has a field with the given name. If an expected value is provided, it also succeeds if the actual value's field has the same value.

Example:

Expect(result).To(be_structs.HavingField[TestStruct]("Field1", "hello1"))
Expect(result).To(be_structs.HavingField[TestStruct]("Field2"))

Types

This section is empty.

Jump to

Keyboard shortcuts

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