MCPcopy Create free account
hub / github.com/gokcehan/lf / TestApplyBoolOpt

Function TestApplyBoolOpt

eval_test.go:595–623  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

593}
594
595func TestApplyBoolOpt(t *testing.T) {
596 tests := []struct {
597 opt bool
598 e setExpr
599 exp bool
600 }{
601 {true, setExpr{"feature", ""}, true},
602 {true, setExpr{"feature", "true"}, true},
603 {true, setExpr{"feature", "false"}, false},
604 {false, setExpr{"feature", ""}, true},
605 {false, setExpr{"feature", "true"}, true},
606 {false, setExpr{"feature", "false"}, false},
607 {true, setExpr{"nofeature", ""}, false},
608 {false, setExpr{"nofeature", ""}, false},
609 {true, setExpr{"feature!", ""}, false},
610 {false, setExpr{"feature!", ""}, true},
611 }
612
613 for _, test := range tests {
614 testStr := fmt.Sprintf("%v", test)
615 if err := applyBoolOpt(&test.opt, &test.e); err != nil {
616 t.Errorf("at test '%s' expected '%t' but got an error '%s'", testStr, test.exp, err)
617 continue
618 }
619 if test.opt != test.exp {
620 t.Errorf("at test '%s' expected '%t' but got '%t'", testStr, test.exp, test.opt)
621 }
622 }
623}
624
625func TestApplyLocalBoolOpt(t *testing.T) {
626 tests := []struct {

Callers

nothing calls this directly

Calls 1

applyBoolOptFunction · 0.85

Tested by

no test coverage detected