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

Function TestNewLoaderWithOptions

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

Source from the content-addressed store, hash-verified

21}
22
23func TestNewLoaderWithOptions(t *testing.T) {
24 loader := NewLoader(
25 WithEnvExpansion(false),
26 WithEnvPrefix("TEST_"),
27 WithVariables(map[string]string{
28 "custom_var": "custom_value",
29 }),
30 )
31
32 if loader.expandEnv {
33 t.Error("expected expandEnv to be false")
34 }
35 if loader.envPrefix != "TEST_" {
36 t.Errorf("expected envPrefix 'TEST_', got %q", loader.envPrefix)
37 }
38 if loader.variables["custom_var"] != "custom_value" {
39 t.Errorf("expected custom_var to be 'custom_value', got %q", loader.variables["custom_var"])
40 }
41}
42
43func TestExpandVariables(t *testing.T) {
44 // Set test environment variables

Callers

nothing calls this directly

Calls 5

WithEnvExpansionFunction · 0.85
WithEnvPrefixFunction · 0.85
WithVariablesFunction · 0.85
NewLoaderFunction · 0.70
ErrorMethod · 0.65

Tested by

no test coverage detected