(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestExpandVariablesWithCustomVariables(t *testing.T) { |
| 122 | loader := NewLoader(WithVariables(map[string]string{ |
| 123 | "CUSTOM_VAR": "custom_value", |
| 124 | })) |
| 125 | |
| 126 | result := loader.expandVariables("${CUSTOM_VAR}") |
| 127 | if result != "custom_value" { |
| 128 | t.Errorf("expected 'custom_value', got %q", result) |
| 129 | } |
| 130 | |
| 131 | // Custom variables should take precedence over environment |
| 132 | _ = os.Setenv("CUSTOM_VAR", "env_value") |
| 133 | defer func() { _ = os.Unsetenv("CUSTOM_VAR") }() |
| 134 | |
| 135 | result = loader.expandVariables("${CUSTOM_VAR}") |
| 136 | if result != "custom_value" { |
| 137 | t.Errorf("expected custom variable to take precedence, got %q", result) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func TestExpandVariablesDisabled(t *testing.T) { |
| 142 | _ = os.Setenv("TEST_VAR", "test_value") |
nothing calls this directly
no test coverage detected