Documentation
¶
Overview ¶
Package fileblock implements evaluation of file assertions parsed from rehearse scenario `### Assert: file` headings. Each evaluation function is a pure function (no global state, no side effects beyond reading the filesystem) that returns (passed bool, message string).
Index ¶
- func Eval(fa scenario.FileAssertion, workDir string) (bool, string)
- func EvalContains(path, expected string) (bool, string)
- func EvalExists(path string) (bool, string)
- func EvalMissing(path string) (bool, string)
- func EvalNotContains(path, expected string) (bool, string)
- func EvalPermissions(path, expected string) (bool, string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Eval ¶
func Eval(fa scenario.FileAssertion, workDir string) (bool, string)
Eval is the dispatcher: it resolves the path (relative paths are joined to workDir; absolute paths are used as-is) and delegates to the appropriate evaluation function based on fa.Kind. If the path contains glob characters (*?[), it expands the glob and applies set-based logic to all matched files.
func EvalContains ¶
EvalContains returns (true, "") when the file at path contains the expected substring, or (false, message) when it does not. Returns (false, message) when the file cannot be read.
func EvalExists ¶
EvalExists returns (true, "") when path exists on the filesystem, or (false, message) when it does not.
func EvalMissing ¶
EvalMissing is the inverse of EvalExists: returns (true, "") when path is absent, or (false, message) when the file exists.
func EvalNotContains ¶
EvalNotContains is the inverse of EvalContains: returns (true, "") when the file does not contain the substring, or (false, message) when it does. Returns (false, message) when the file cannot be read.
func EvalPermissions ¶
EvalPermissions returns (true, "") when the file's permission bits match the expected octal string (e.g. "0644"), or (false, message) when they differ. Returns (false, message) when the file cannot be stat'd.
Types ¶
This section is empty.