Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmashko committed Sep 14, 2023
1 parent 1ff9fec commit 0cf7449
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions external_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package envconf

import "testing"

func TestExternal_EmpExt_Ok(t *testing.T) {
e := emptyExt{}
if e.TagName() != "" || e.Unmarshal(nil) != nil {
t.Error("unexpected result")
}
}

func TestExternal_newExternalConfig_Ok(t *testing.T) {
ext := newExternalConfig(emptyExt{})
if ext == nil {
t.Fail()
}
if ext.Unmarshal(nil) != nil {
t.Error("unexpected result")
}
}

func TestExternal_InvalidJson_Err(t *testing.T) {
jsonConf := NewJsonConfig()
jsonConf.Read([]byte("<test></test>"))
ext := newExternalConfig(jsonConf)
tc := struct {
Foo int
}{}
if ext.Unmarshal(&tc) == nil {
t.Error("unexpected error got nil")
}
}

0 comments on commit 0cf7449

Please sign in to comment.