add testcase for bool
This commit is contained in:
@@ -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")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user