- fixed TestDictKeysMan bug
- order api added.
This commit is contained in:
@@ -15,16 +15,22 @@ func (t TT) foo() {
|
||||
|
||||
}
|
||||
func TestDictKeysMan(t *testing.T) {
|
||||
testData := map[string]string{"k1": "v1", "k2": "v2"}
|
||||
testData := map[string]interface{}{"k1": "v1", "k2": "v2"}
|
||||
result1 := DictKeysMan(testData, []string{"k1"}, nil).(map[string]interface{})
|
||||
if _, ok := result1["k1"]; ok {
|
||||
t.Error("Params keysToRemove can not remove key!")
|
||||
}
|
||||
if _, ok := result1["k2"]; !ok {
|
||||
if k2Value, ok := result1["k2"]; !ok {
|
||||
t.Error("Params keysToRemove removed wrong key!")
|
||||
} else {
|
||||
k2ValueStr, _ := k2Value.(string)
|
||||
if k2ValueStr != "v2" {
|
||||
t.Logf("k2Value:%s", k2ValueStr)
|
||||
t.Error("wrong data when removeKeys")
|
||||
}
|
||||
}
|
||||
|
||||
result2 := DictKeysMan([]interface{}{testData}, nil, []string{"k1"}).([]interface{})
|
||||
result2 := DictKeysMan([]interface{}{testData, map[string]string{"k1": "v11", "k2": "v22"}}, nil, []string{"k1"}).([]interface{})
|
||||
result20 := result2[0].(map[string]interface{})
|
||||
if _, ok := result20["k1"]; !ok {
|
||||
t.Error("Params keysToKeep can not keep key!")
|
||||
|
||||
Reference in New Issue
Block a user