map, filter and cat return an iterator
This commit is contained in:
+1
-34
@@ -43,49 +43,16 @@ func TestOperator(t *testing.T) {
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestOperatorMap(t *testing.T) {
|
||||
section := "Operator-Map"
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`a=1; --a`, int64(0), nil},
|
||||
/* 2 */ {`[1,2,3] map var("_")`, kern.NewList([]any{int64(1), int64(2), int64(3)}), nil},
|
||||
/* 3 */ {`[1,2,3] map $_`, kern.NewList([]any{int64(1), int64(2), int64(3)}), nil},
|
||||
}
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 3)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestOperatorFilter(t *testing.T) {
|
||||
section := "Operator-Filter"
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`[1,2,3,4] filter ($_ % 2 == 0)`, kern.NewList([]any{int64(2), int64(4)}), nil},
|
||||
}
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 1)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestOperatorDigest(t *testing.T) {
|
||||
section := "Operator-Digest"
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`max=0; [2,3,1] digest max=(($_ > max) ? {$_} :: {max})`, int64(3), nil},
|
||||
/* 1 */ {`max=0; [2,3,1] digest (max=(($_ > max) ? {$_} :: {max}))`, int64(3), nil},
|
||||
}
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 29)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestOperatorCat(t *testing.T) {
|
||||
section := "Operator-Cat"
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`["a","b"] cat ["x"]`, kern.NewList([]any{"a", "b", "x"}), nil},
|
||||
/* 2 */ {`["a","b"] cat ["x"-true]`, nil, `[1:20] left operand 'x' [string] and right operand 'true' [bool] are not compatible with operator "-"`},
|
||||
}
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 2)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestOperatorGroupBy(t *testing.T) {
|
||||
section := "Operator-GroupBy"
|
||||
inputs := []inputType{
|
||||
|
||||
Reference in New Issue
Block a user