MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestSetOption

Function TestSetOption

repl/evaluator_test.go:454–473  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

452}
453
454func TestSetOption(t *testing.T) {
455 eval, err := NewEvaluator()
456 if err != nil {
457 t.Fatalf("NewEvaluator() failed with: %v", err)
458 }
459
460 err = eval.AddSerializableOption(&testContainerOption{container: "google.protobuf"})
461 if err != nil {
462 t.Errorf("eval.AddSerializableOption() got error: %v, wanted nil", err)
463 }
464
465 val, _, err := eval.Evaluate("Int64Value{value: 42} == 42")
466 if err != nil {
467 t.Errorf("eval.Evaluate() got error: %v, expected nil", err)
468 }
469
470 if !val.Value().(bool) {
471 t.Error("eval.Evaluate() got false expected true")
472 }
473}
474
475func TestSetOptionError(t *testing.T) {
476 eval, err := NewEvaluator()

Callers

nothing calls this directly

Calls 5

AddSerializableOptionMethod · 0.95
EvaluateMethod · 0.95
NewEvaluatorFunction · 0.85
ValueMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected