new operator 'groupby'
This commit is contained in:
+17
-13
@@ -6,7 +6,6 @@ package expr
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -74,7 +73,6 @@ func doTest(t *testing.T, ctx kern.ExprContext, section string, input *inputType
|
||||
var ast Expr
|
||||
var gotResult any
|
||||
var gotErr error
|
||||
var eq, eqDone bool
|
||||
|
||||
wantErr := getWantedError(input)
|
||||
|
||||
@@ -93,18 +91,24 @@ func doTest(t *testing.T, ctx kern.ExprContext, section string, input *inputType
|
||||
gotResult, gotErr = ast.Eval(ctx)
|
||||
}
|
||||
|
||||
if input.wantResult != nil && gotResult != nil {
|
||||
if ls1, ok := input.wantResult.(*kern.ListType); ok {
|
||||
if ls2, ok := gotResult.(*kern.ListType); ok {
|
||||
eq = ls1.Equals(*ls2)
|
||||
eqDone = true
|
||||
}
|
||||
}
|
||||
}
|
||||
eq := kern.Equal(gotResult, input.wantResult)
|
||||
// if input.wantResult != nil && gotResult != nil {
|
||||
// if ls1, ok := input.wantResult.(*kern.ListType); ok {
|
||||
// if ls2, ok := gotResult.(*kern.ListType); ok {
|
||||
// eq = ls1.Equals(*ls2)
|
||||
// eqDone = true
|
||||
// }
|
||||
// } else if dict1, ok := input.wantResult.(*kern.DictType); ok {
|
||||
// if dict2, ok := gotResult.(*kern.DictType); ok {
|
||||
// eq = dict1.Equals(*dict2)
|
||||
// eqDone = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if !eqDone {
|
||||
eq = reflect.DeepEqual(gotResult, input.wantResult)
|
||||
}
|
||||
// if !eqDone {
|
||||
// eq = reflect.DeepEqual(gotResult, input.wantResult)
|
||||
// }
|
||||
|
||||
if !eq /*gotResult != input.wantResult*/ {
|
||||
t.Errorf(">>>%s/%d: `%s` -> result = %v [%s], want = %v [%s]", section, count, input.source, gotResult, kern.TypeName(gotResult), input.wantResult, kern.TypeName(input.wantResult))
|
||||
|
||||
Reference in New Issue
Block a user