mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
CEL lazy map: add test for boolean short-circuiting
This commit is contained in:
parent
ef4907eddd
commit
66aa2af097
@ -93,6 +93,17 @@ func TestLazyMapType(t *testing.T) {
|
|||||||
if evalCounter != 1 {
|
if evalCounter != 1 {
|
||||||
t.Errorf("expected eval %d times but got %d", 1, evalCounter)
|
t.Errorf("expected eval %d times but got %d", 1, evalCounter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unused due to boolean short-circuiting
|
||||||
|
// if `variables.unused` is evaluated, the whole test will have a fatal error and exit.
|
||||||
|
exp = "variables.dict.a == 'wrong' && variables.unused == 'unused'"
|
||||||
|
v, err = compileAndRun(env, activation, exp)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%q: %v", exp, err)
|
||||||
|
}
|
||||||
|
if v.Value().(bool) != false {
|
||||||
|
t.Errorf("%q: wrong result: %v", exp, v.Value())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type testActivation struct {
|
type testActivation struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user