mirror of
https://github.com/joho/godotenv.git
synced 2025-07-15 00:30:16 +00:00
Add test for substitutions
This commit is contained in:
parent
9be76b3741
commit
33977c2d8d
5
fixtures/substitutions.env
Normal file
5
fixtures/substitutions.env
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
OPTION_A=1
|
||||||
|
OPTION_B=${OPTION_A}
|
||||||
|
OPTION_C=$OPTION_B
|
||||||
|
OPTION_D=${OPTION_A}${OPTION_B}
|
||||||
|
OPTION_E=${OPTION_NOT_DEFINED}
|
@ -193,6 +193,19 @@ func TestLoadQuotedEnv(t *testing.T) {
|
|||||||
loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets)
|
loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSubstituitions(t *testing.T) {
|
||||||
|
envFileName := "fixtures/substitutions.env"
|
||||||
|
expectedValues := map[string]string{
|
||||||
|
"OPTION_A": "1",
|
||||||
|
"OPTION_B": "1",
|
||||||
|
"OPTION_C": "1",
|
||||||
|
"OPTION_D": "11",
|
||||||
|
"OPTION_E": "",
|
||||||
|
}
|
||||||
|
|
||||||
|
loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets)
|
||||||
|
}
|
||||||
|
|
||||||
func TestActualEnvVarsAreLeftAlone(t *testing.T) {
|
func TestActualEnvVarsAreLeftAlone(t *testing.T) {
|
||||||
os.Clearenv()
|
os.Clearenv()
|
||||||
os.Setenv("OPTION_A", "actualenv")
|
os.Setenv("OPTION_A", "actualenv")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user