builtin-base: removed useless function unset(). See UNSET operator
This commit is contained in:
@@ -72,3 +72,56 @@ func TestFuncBase(t *testing.T) {
|
||||
// runTestSuiteSpec(t, section, inputs, 49)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestFuncBaseString(t *testing.T) {
|
||||
section := "Builtin-Base-String"
|
||||
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`string(3)`, "3", nil},
|
||||
/* 2 */ {`string(3.5)`, "3.5", nil},
|
||||
/* 3 */ {`string(true)`, "true", nil},
|
||||
/* 4 */ {`string(false)`, "false", nil},
|
||||
/* 5 */ {`string("123")`, "123", nil},
|
||||
/* 6 */ {`string(1:2)`, "1:2", nil},
|
||||
}
|
||||
|
||||
// t.Setenv("EXPR_PATH", ".")
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 49)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestFuncBaseFraction(t *testing.T) {
|
||||
section := "Builtin-Base-Fraction"
|
||||
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`fract(-0.5)`, kern.NewFraction(-1, 2), nil},
|
||||
/* 2 */ {`fract("")`, (*kern.FractionType)(nil), `bad syntax`},
|
||||
/* 3 */ {`fract("-1")`, kern.NewFraction(-1, 1), nil},
|
||||
/* 4 */ {`fract("+1")`, kern.NewFraction(1, 1), nil},
|
||||
/* 5 */ {`fract("1a")`, (*kern.FractionType)(nil), `strconv.ParseInt: parsing "1a": invalid syntax`},
|
||||
/* 6 */ {`fract(1,0)`, nil, `fract(): division by zero`},
|
||||
/* 7 */ {`fract(5, "1")`, nil, `fract(): expected integer, got string ("1")`},
|
||||
/* 8 */ {`fract(true)`, kern.NewFraction(1, 1), nil},
|
||||
/* 9 */ {`fract(false)`, kern.NewFraction(0, 1), nil},
|
||||
}
|
||||
|
||||
// t.Setenv("EXPR_PATH", ".")
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 8)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
func TestFuncBaseOthers(t *testing.T) {
|
||||
section := "Builtin-Base-Others"
|
||||
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`set("a", 3); a`, int64(3), nil},
|
||||
/* 2 */ {`set(true, 3)`, nil, `set(): the "name" parameter must be a string, got a bool (true)`},
|
||||
// /* 3 */ {`a=3; unset("a"); a`, nil, `undefined variable or function "a"`},
|
||||
// /* 4 */ {`unset("a")`, nil, `undefined variable or function "a"`},
|
||||
}
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 4)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user