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)
| 417 | // - configure the Compiler used for parsing and compiling the input expressions |
| 418 | // - configure the Test Runner used for parsing and executing the tests |
| 419 | func 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 |
no outgoing calls