Documentation
¶
Overview ¶
Package store holds scenario variables and performs ${name} expansion. Expansion is deliberately simple substitution — atago is not a programming language.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Escape ¶ added in v0.3.2
Escape rewrites text so that Expand returns it verbatim: it prefixes an extra `$` onto exactly the references Expand acts on — a live `${name}` becomes the literal `$${name}`, and an already-escaped `$${name}` becomes `$$${name}` — while a `${` that Expand ignores (one not followed by a valid name, e.g. `${1}` or `${}`) is left untouched, because Expand would already pass it through. It is the exact inverse Expand relies on, so raw observed text (a recorded command, output anchor, or typed pty input) can be embedded in a spec without being re-expanded at replay. A blind `${`→`$${` rewrite is wrong: the expander only unescapes `$${<valid-name>}`, so `$${1}` would never round-trip back to the observed `${1}`.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a per-scenario variable map.
func (*Store) Expand ¶
Expand replaces ${name} references with stored values and ${env:NAME} references with host environment variables. Unknown references are left verbatim so they surface as obvious failures rather than empty strings.
func (*Store) Unresolved ¶
Unresolved returns the names of ${name} references in in that no stored variable resolves, and of ${env:NAME} references whose environment variable is not set. Escaped $${name} literals are not reported — the author explicitly asked for literal text. Callers use this to turn a reference that nothing could ever expand into an explained failure instead of passing the literal text on.