Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmashko committed Oct 17, 2023
1 parent aaf46cf commit 0e6b146
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions external/external_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@ func TestJsonConfig_IncorrectType_Err(t *testing.T) {
}
}

func TestJsonConfig_NilPointer_Ok(t *testing.T) {
json := `{"foo":null,"bar":null}`
tc := struct {
Foo *string `json:"foo"`
Bar interface{} `json:"bar"`
}{}
if err := envconf.Parse(&tc, option.WithExternal(jsonconf.Json([]byte(json)))); err != nil {
t.Errorf("expected error but got nil")
}
if tc.Foo != nil || tc.Bar != nil {
t.Fatalf("unexpected result. expected nil got %v", tc)
}
}

func TestJsonConfig_Array_Ok(t *testing.T) {
json := `{"foo":[2, 3, 4, 5]}`
tc := struct {
Expand Down

0 comments on commit 0e6b146

Please sign in to comment.