forked from coop-cloud-mirrors/godotenv
Use SplitN instead of split
This commit is contained in:
2
fixtures/equals.env
Normal file
2
fixtures/equals.env
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export OPTION_A='postgres://localhost:5432/database?sslmode=disable'
|
||||||
|
|
@ -138,7 +138,7 @@ func parseLine(line string) (key string, value string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now split key from value
|
// now split key from value
|
||||||
splitString := strings.Split(line, "=")
|
splitString := strings.SplitN(line, "=", 2)
|
||||||
|
|
||||||
if len(splitString) != 2 {
|
if len(splitString) != 2 {
|
||||||
// try yaml mode!
|
// try yaml mode!
|
||||||
|
@ -93,6 +93,15 @@ func TestLoadExportedEnv(t *testing.T) {
|
|||||||
loadEnvAndCompareValues(t, envFileName, expectedValues)
|
loadEnvAndCompareValues(t, envFileName, expectedValues)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadEqualsEnv(t *testing.T) {
|
||||||
|
envFileName := "fixtures/equals.env"
|
||||||
|
expectedValues := map[string]string{
|
||||||
|
"OPTION_A": "postgres://localhost:5432/database?sslmode=disable",
|
||||||
|
}
|
||||||
|
|
||||||
|
loadEnvAndCompareValues(t, envFileName, expectedValues)
|
||||||
|
}
|
||||||
|
|
||||||
func TestLoadQuotedEnv(t *testing.T) {
|
func TestLoadQuotedEnv(t *testing.T) {
|
||||||
envFileName := "fixtures/quoted.env"
|
envFileName := "fixtures/quoted.env"
|
||||||
expectedValues := map[string]string{
|
expectedValues := map[string]string{
|
||||||
|
Reference in New Issue
Block a user