test(file): improve

This commit is contained in:
Geno 2021-06-02 17:06:27 +02:00
parent 0902defa8a
commit 95b99107f5
1 changed files with 15 additions and 0 deletions

View File

@ -8,6 +8,21 @@ import (
"github.com/stretchr/testify/assert"
)
func TestTOMLDuration(t *testing.T) {
assert := assert.New(t)
var d TOMLDuration
err := d.UnmarshalText([]byte("5m"))
assert.NoError(err)
err = d.UnmarshalText([]byte("5z"))
assert.Error(err)
txt, err := d.MarshalText()
assert.NoError(err)
assert.Equal("5m0s", string(txt))
}
func TestReadTOML(t *testing.T) {
assert := assert.New(t)