increased test coverage (83.9%)
This commit is contained in:
@@ -6,6 +6,8 @@ package expr
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
)
|
||||
|
||||
func TestCtrlSet(t *testing.T) {
|
||||
@@ -58,3 +60,35 @@ func TestCtrlGetNotDefined(t *testing.T) {
|
||||
t.Errorf(`%s -- CtrlGet(%q) should have returned nil, got %v`, section, varName, v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCtrlEnable(t *testing.T) {
|
||||
section := "Context"
|
||||
varName := "test_var"
|
||||
varValue := true
|
||||
|
||||
ctx := NewSimpleStore()
|
||||
GlobalCtrlSet(ctx, varName, varValue)
|
||||
if !CtrlEnable(ctx, varName) {
|
||||
t.Errorf(`%s -- CtrlEnable(ctx, %q) should have returned 'true', got 'false'`, section, varName)
|
||||
}
|
||||
|
||||
if !CtrlDisable(ctx, varName) {
|
||||
t.Errorf(`%s -- CtrlEnable(ctx, %q) should have returned 'true', got 'false'`, section, varName)
|
||||
// t.Errorf(`%s -- CtrlEnable(ctx, %q) should have returned 'false', got 'true'`, section, varName)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
section := "Context"
|
||||
|
||||
inputs := []inputType{
|
||||
/* 1 */ {`$$(5)`, kern.NewLinkedListA(5), nil},
|
||||
/* 2 */ {`$$($(2))`, kern.NewLinkedListA(0, 1), nil},
|
||||
/* 3 */ {`string(($$global).funcs.bool)`, `bool(value):boolean{}`, nil},
|
||||
}
|
||||
|
||||
runTestSuiteSpec(t, section, inputs, 3)
|
||||
// runTestSuite(t, section, inputs)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user