Skip to content

Commit

Permalink
resolve testcase error
Browse files Browse the repository at this point in the history
  • Loading branch information
jack.jin committed Feb 7, 2023
1 parent 4423ae4 commit 588cd92
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions altsrc/yaml_file_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ func ExampleApp_Run_yamlFileLoaderDuration() {
}

func TestYamlFileInt64Slice(t *testing.T) {
_ = ioutil.WriteFile("current.yaml", []byte(`top: [100, 9223372036854775808]`), 0666)
_ = ioutil.WriteFile("current.yaml", []byte(`top:
test: [100, 9223372036854775808]`), 0666)
defer os.Remove("current.yaml")

testFlag := []cli.Flag{
&altsrc.StringFlag{StringFlag: &cli.StringFlag{Name: "conf"}},
&altsrc.Int64SliceFlag{Int64SliceFlag: &cli.Int64SliceFlag{Name: "top", EnvVars: []string{"THE_TEST"}}},
&altsrc.Int64SliceFlag{Int64SliceFlag: &cli.Int64SliceFlag{Name: "top.test"}},
}
app := &cli.App{}
app.Before = altsrc.InitInputSourceWithContext(testFlag, altsrc.NewYamlSourceFromFlagFunc("conf"))
Expand All @@ -105,7 +106,7 @@ func TestYamlFileInt64Slice(t *testing.T) {

test := []string{"testApp", "--conf", "current.yaml"}
if err := app.Run(test); err == nil {
t.Error("Should return the mismatch type error")
t.Error("should return the mismatch type error")
}
}

Expand Down

0 comments on commit 588cd92

Please sign in to comment.