use of org.projectnessie.cel.common.CELError in project cel-java by projectnessie.
the class ParserTest method expressionSizeCodePointLimit.
@Test
void expressionSizeCodePointLimit() {
assertThatThrownBy(() -> new Parser(Options.builder().macros(Macro.AllMacros).expressionSizeCodePointLimit(-2).build())).isInstanceOf(IllegalArgumentException.class).hasMessage("expression size code point limit must be greater than or equal to -1: -2");
Parser p = new Parser(Options.builder().macros(Macro.AllMacros).expressionSizeCodePointLimit(2).build());
Source src = Source.newTextSource("foo");
ParseResult parseResult = p.parse(src);
assertThat(parseResult.getErrors().getErrors()).containsExactly(new CELError(Location.newLocation(-1, -1), "expression code point size exceeds limit: size: 3, limit 2"));
}
Aggregations