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

Function TestSetOptionError

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

Source from the content-addressed store, hash-verified

473}
474
475func TestSetOptionError(t *testing.T) {
476 eval, err := NewEvaluator()
477 if err != nil {
478 t.Fatalf("NewEvaluator() failed with: %v", err)
479 }
480
481 err = eval.AddSerializableOption(&testContainerOption{container: "google.protobuf"})
482 if err != nil {
483 t.Errorf("eval.AddSerializableOption() got error: %v, wanted nil", err)
484 }
485
486 err = eval.AddLetVar("x", "Int64Value{value: 42} == 42", nil)
487 if err != nil {
488 t.Errorf("eval.Evaluate() got error: %v, expected nil", err)
489 }
490
491 err = eval.AddSerializableOption(&testContainerOption{container: ""})
492 if err == nil {
493 t.Error("eval.AddSerializableOption() got nil expected error")
494 }
495}
496
497func TestProcess(t *testing.T) {
498 var testCases = []struct {

Callers

nothing calls this directly

Calls 4

AddSerializableOptionMethod · 0.95
AddLetVarMethod · 0.95
NewEvaluatorFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected