mirror of https://github.com/joho/godotenv.git
Add test for substitutions
parent
9be76b3741
commit
33977c2d8d
|
@ -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…
Reference in New Issue