Skip to content

Commit

Permalink
addback invalid interface testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
sontrinh16 committed Dec 15, 2023
1 parent c2b5e32 commit ed86b82
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func TestTreeFn(t *testing.T) {
func TestGetTreeNameFromConstructorFn(t *testing.T) {
treeName := "testing_get_tree_name_tree"
treeConstructorFn := sudoConstructorFn
invalidTreeName := struct{}{}
invalidCaseTreeName := "invalid_case_tree"
invalidTreeConstructorFn := "invalid constructor fn"

tests := []struct {
name string
Expand All @@ -127,6 +130,30 @@ func TestGetTreeNameFromConstructorFn(t *testing.T) {
func() {},
false,
},
{
"get invalid interface value",
"",
nil,
func() {
// Seems like this case has low probability of happening
// since all register has been done through RegisterTree func
// which have strict type check as argument.
treeFns.Store(invalidCaseTreeName, invalidTreeConstructorFn)
},
false,
},
{
"get invalid interface key",
"",
nil,
func() {
// Seems like this case has low probability of happening
// since all register has been done through RegisterTree func
// which have strict type check as argument.
treeFns.Store(invalidTreeName, treeConstructorFn)
},
false,
},
}

for _, test := range tests {
Expand Down

0 comments on commit ed86b82

Please sign in to comment.