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

Function NewTestRunner

tools/celtest/test_runner.go:419–432  ·  view source on GitHub ↗

NewTestRunner creates a Test Runner with the provided options. The options can be used to: - configure the Compiler used for parsing and compiling the input expressions - configure the Test Runner used for parsing and executing the tests

(opts ...TestRunnerOption)

Source from the content-addressed store, hash-verified

417// - configure the Compiler used for parsing and compiling the input expressions
418// - configure the Test Runner used for parsing and executing the tests
419func NewTestRunner(opts ...TestRunnerOption) (*TestRunner, error) {
420 tr := &TestRunner{
421 activationFactory: cel.NewActivation,
422 testSuiteParser: &tsParser{},
423 }
424 var err error
425 for _, opt := range opts {
426 tr, err = opt(tr)
427 if err != nil {
428 return nil, err
429 }
430 }
431 return tr, nil
432}
433
434// TestExpression returns a TestRunnerOption which configures a policy file, expression file, or raw expression
435// for testing

Callers 3

runTestSuiteFunction · 0.92
TestCoverageStatsFunction · 0.85
TriggerTestsFunction · 0.85

Calls

no outgoing calls

Tested by 2

runTestSuiteFunction · 0.74
TestCoverageStatsFunction · 0.68