forked from TrueCloudLab/frostfs-node
[#577] cmd/node: Add tests for boolean type casting in config
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
ed80f704d0
commit
52c82ef46a
3 changed files with 33 additions and 0 deletions
|
@ -63,6 +63,25 @@ func TestDuration(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestBool(t *testing.T) {
|
||||
configtest.ForEachFileType("test/config", func(c *config.Config) {
|
||||
c = c.Sub("bool")
|
||||
|
||||
val := config.Bool(c, "correct")
|
||||
require.Equal(t, true, val)
|
||||
|
||||
val = config.Bool(c, "correct_string")
|
||||
require.Equal(t, true, val)
|
||||
|
||||
require.Panics(t, func() {
|
||||
config.Bool(c, "incorrect")
|
||||
})
|
||||
|
||||
val = config.BoolSafe(c, "incorrect")
|
||||
require.Equal(t, false, val)
|
||||
})
|
||||
}
|
||||
|
||||
func TestNumbers(t *testing.T) {
|
||||
configtest.ForEachFileType("test/config", func(c *config.Config) {
|
||||
c = c.Sub("number")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue