EQL: [Test] Add a test for `identifier` as eventType (#63227) (#63235)

Add a unit test to verify that an identifier surrounded with backquotes
is not a valid syntax for eventType value, as eventType is
schemantically a string literal and not a field identifier.

Follows: #63169
(cherry picked from commit ff12c1340b3890ac52251f31259fa9a719d9eacc)
This commit is contained in:
Marios Trivyzas 2020-10-05 16:23:08 +03:00 committed by GitHub
parent 1047d67199
commit 19650e860a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -263,6 +263,12 @@ public class ExpressionTests extends ESTestCase {
assertEquals("line 1:19: token recognition error at: '` == true'", e.getMessage()); assertEquals("line 1:19: token recognition error at: '` == true'", e.getMessage());
} }
public void testIdentifierForEventTypeDisallowed() {
ParsingException e = expectThrows(ParsingException.class, "Expected syntax error",
() -> parser.createStatement("`identifier` where foo == true"));
assertEquals("line 1:1: no viable alternative at input '`identifier`'", e.getMessage());
}
public void testFunctions() { public void testFunctions() {
List<Expression> arguments = Arrays.asList( List<Expression> arguments = Arrays.asList(
new UnresolvedAttribute(null, "some.field"), new UnresolvedAttribute(null, "some.field"),