Skip to content

Commit

Permalink
fix: test on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 8, 2019
1 parent 92988dd commit 3cc84b0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"bytes"
"fmt"
"os"
"testing"

"github.com/gookit/config/v2/dotnev"
Expand Down Expand Up @@ -267,9 +268,21 @@ func TestOptions(t *testing.T) {
str := c.String("name")
st.Equal("app", str)

// test: parse env name
shell := os.Getenv("SHELL")
// ensure env var is exist
if shell == "" {
_= os.Setenv("SHELL", "/usr/bin/bash")
}

str = c.String("envKey")
st.NotContains(str, "${")

// revert
if shell != "" {
_= os.Setenv("SHELL", shell)
}

str = c.String("invalidEnvKey")
st.Contains(str, "${")

Expand Down

0 comments on commit 3cc84b0

Please sign in to comment.