package envcheck
import "cel.dev/expr/tests/envcheck"
Package envcheck checks runtime support of declarations.
A set of checker declarations is scanned to produce a set of CEL parse trees, each of which is then sent to the runtime.
Identifier declarations are compiled to an expression of just that identifiers. For instance, the "int" type identifier produces:
int
Function declarations are compiled to a separate expression for each overload. The expression is an invocation of the overload with "zeroish" arguments of the appropriate type. The zeroish arguments are:
int 0 uint 0u double 0.0 bool false string "" bytes b"" null_type null type type list<A> [] map<A,B> {} enum E 0 message M M{}
For instance, the "_/_" function with overloads
_/_: (int, int) -> int _/_: (uint, uint) -> uint _/_: (double, double) -> double
compiles to the expressions
(0)/(0) (0u)/(0u) (0.0)/(0.0)
which are then evaluated.
This test suite does not check that the overloads are implemented correctly, only that they are implemented at all. The test will pass unless the expression evaluates (with no bindings) to any result or error other than "no_matching_overload". For instance, the first two expressions for _/_ will generate division-by-zero errors, but this will pass the test.
Index ¶
Source Files ¶
envcheck.go
- Version
- v0.3.0
- Published
- Aug 20, 2019
- Platform
- windows/amd64
- Imports
- 9 packages
- Last checked
- 2 minutes ago –
Tools for package owners.