the common test framework now supports error, string and nil as value of the wantErr field

This commit is contained in:
2024-07-06 16:43:13 +02:00
parent 9fc20077a1
commit 896844e772
12 changed files with 74 additions and 83 deletions
+2 -3
View File
@@ -5,7 +5,6 @@
package expr
import (
"errors"
"testing"
)
@@ -14,7 +13,7 @@ func TestFuncMathArith(t *testing.T) {
inputs := []inputType{
/* 1 */ {`builtin "math.arith"; add(1,2)`, int64(3), nil},
/* 2 */ {`builtin "math.arith"; add(1,2,3)`, int64(6), nil},
/* 3 */ {`builtin "math.arith"; mulX(1,2,3)`, nil, errors.New(`unknown function mulX()`)},
/* 3 */ {`builtin "math.arith"; mulX(1,2,3)`, nil, `unknown function mulX()`},
/* 4 */ {`builtin "math.arith"; add(1+4,3+2,5*(3-2))`, int64(15), nil},
/* 5 */ {`builtin "math.arith"; add(add(1+4),3+2,5*(3-2))`, int64(15), nil},
/* 6 */ {`builtin "math.arith"; add(add(1,4),/*3+2,*/5*(3-2))`, int64(10), nil},
@@ -24,6 +23,6 @@ func TestFuncMathArith(t *testing.T) {
// t.Setenv("EXPR_PATH", ".")
// parserTestSpec(t, section, inputs, 69)
// runTestSuiteSpec(t, section, inputs, 1)
runTestSuite(t, section, inputs)
}