Internal

internal/core/acceptance

Package acceptance evaluates criterion evidence against expected result kinds.

import "github.com/nilstate/scafld/v2/internal/core/acceptance"

Package acceptance evaluates criterion evidence against expected result kinds.

Constants

Source: internal/core/acceptance/model.go:10

const (
	// ExpectedExitCodeZero passes when the command exits with code 0.
	ExpectedExitCodeZero ExpectedKind = "exit_code_zero"
	// ExpectedExitCodeNonzero passes when the command exits with a non-zero code.
	ExpectedExitCodeNonzero ExpectedKind = "exit_code_nonzero"
	// ExpectedNoMatches passes when the captured output is empty.
	ExpectedNoMatches ExpectedKind = "no_matches"
	// ExpectedManual marks a criterion that requires human evidence.
	ExpectedManual ExpectedKind = "manual"
	// ExpectedBrowserEvidence passes when a browser command exits cleanly and emits a valid browser evidence packet.
	ExpectedBrowserEvidence ExpectedKind = "browser_evidence"
)

Functions

func Evaluate(kind ExpectedKind, evidence Evidence) Result

Source: internal/core/acceptance/model.go:46

Evaluate compares evidence with the requested expected kind.

func ValidExpectedKind(kind ExpectedKind) bool

Source: internal/core/acceptance/model.go:22

ValidExpectedKind reports whether kind is supported by the evaluator.

Types

type Evidence

Source: internal/core/acceptance/model.go:32

Evidence is the command output used to evaluate an acceptance criterion.

type Evidence struct {
	ExitCode   int
	Output     string
	Command    string
	Diagnostic string
}
Fields
  • ExitCode int
  • Output string
  • Command string
  • Diagnostic string

type ExpectedKind

Source: internal/core/acceptance/model.go:6

ExpectedKind names the machine-checkable expectation for criterion evidence.

type ExpectedKind string

type Result

Source: internal/core/acceptance/model.go:40

Result is the normalized pass/fail/pending outcome for criterion evidence.

type Result struct {
	Status string
	Reason string
}
Fields
  • Status string
  • Reason string