test MergeClause of Set

This commit is contained in:
sdghchj 2020-12-28 13:27:50 +08:00 committed by GitHub
parent 51210324ac
commit ed06a5a461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,3 +55,25 @@ func TestAssignments(t *testing.T) {
t.Errorf("invalid assignments, got %v", assignments)
}
}
func TestMergeClause(t *testing.T) {
set1 := clause.Assignments(map[string]interface{}{
"name": "jinzhu",
})
set2 := clause.Assignments(map[string]interface{}{
"age": 18,
})
c := &clause.Clause{
Name: "Set",
Expression: set1,
}
set2.MergeClause(c)
if set3, ok := c.Expression.(clause.Set); ok {
if len(set3) == 2 {
return
}
}
t.Error("invalid merge set")
}