add testcase for bool

This commit is contained in:
RiyaJohn
2020-05-18 16:13:17 +05:30
parent ecd155a62f
commit 100799f7b7
+7
View File
@@ -44,6 +44,7 @@ func TestTomlGetArray(t *testing.T) {
tree, _ := Load(` tree, _ := Load(`
[test] [test]
key = ["one", "two"] key = ["one", "two"]
key2 = [true, false, false]
`) `)
if tree.GetArray("") != tree { if tree.GetArray("") != tree {
@@ -56,6 +57,12 @@ func TestTomlGetArray(t *testing.T) {
t.Errorf("GetArray should return the []string value") t.Errorf("GetArray should return the []string value")
} }
expect2 := []bool{true, false, false}
actual2 := tree.GetArray("test.key2").([]bool)
if !reflect.DeepEqual(actual2, expect2) {
t.Errorf("GetArray should return the []string value")
}
if tree.GetArray(`\`) != nil { if tree.GetArray(`\`) != nil {
t.Errorf("should return nil when the key is malformed") t.Errorf("should return nil when the key is malformed")
} }