MCPcopy Create free account
hub / github.com/astercloud/aster / TestRequiredVariableError

Function TestRequiredVariableError

pkg/config/loader_test.go:564–575  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

562}
563
564func TestRequiredVariableError(t *testing.T) {
565 loader := NewLoader()
566
567 // Required variable that doesn't exist
568 result := loader.expandVariables("${REQUIRED_VAR:?This variable is required}")
569
570 // The error marker check happens during validation
571 // Let's test that the error marker is inserted or result is empty
572 if result != "" && !containsErrorMarker(result) {
573 t.Logf("result: %q", result)
574 }
575}
576
577func containsErrorMarker(s string) bool {
578 return len(s) > 0 && s[:min(9, len(s))] == "__ERROR__"

Callers

nothing calls this directly

Calls 3

expandVariablesMethod · 0.95
containsErrorMarkerFunction · 0.85
NewLoaderFunction · 0.70

Tested by

no test coverage detected