testingx

package
v1.10.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyTree

func CopyTree(src string, dst string) error

CopyTree copies a directory tree from src to dst.

func PinLocalReplace

func PinLocalReplace(dir string, repoRoot string) error

PinLocalReplace rewrites the copied fixture go.mod to point the github.com/CaliLuke/loom replace directive at repoRoot.

func RepoRoot

func RepoRoot() string

RepoRoot returns the absolute repository root for the current checkout.

func RequireTreeMatches added in v1.2.1

func RequireTreeMatches(t testing.TB, wantDir string, gotDir string)

RequireTreeMatches asserts that gotDir contains exactly the same regular files as wantDir and that each file has identical contents.

func RunCmd

func RunCmd(dir string, name string, args ...string) (string, error)

RunCmd runs a command in dir and returns its combined output.

func ServicePackageShadowNames

func ServicePackageShadowNames(t testing.TB, dir, genpkg, marker string) []string

ServicePackageShadowNames returns the identifiers that the generated Go files below dir declare where a service package imported under the same name would not compile, in the packages that import a service or views package, that is a package whose import path is genpkg/<name> or genpkg/<name>/views:

  • the package-level declarations, which conflict with the import;
  • the receivers, parameters, results and locals in scope where a service or views package is used, which would hide it;
  • in the files that do not import a service or views package, the receivers, parameters, results and locals that are the operand of a selector, such as ws in ws.Close(): a generated file keeps an import when a selector of its name remains, so the file would keep the service package import and leave it unused.

It skips the service and views packages themselves. The result is sorted. It omits struct field names, names with upper case letters, which no generated package name has, and every name that contains marker, so that a test design can mark the names it gives to generated code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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