mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 02:14:54 +00:00
add reserved word tests for 'doc', too
This commit is contained in:
parent
389ef462c4
commit
632bb4c720
@ -37,4 +37,20 @@ public class ReservedWordTests extends ScriptTestCase {
|
||||
});
|
||||
assertTrue(expected.getMessage().contains("Variable [_score] is read-only"));
|
||||
}
|
||||
|
||||
/** check that we can't declare a variable of doc, its really reserved! */
|
||||
public void testDocVar() {
|
||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||
exec("int doc = 5; return doc;");
|
||||
});
|
||||
assertTrue(expected.getMessage().contains("Variable name [doc] already defined"));
|
||||
}
|
||||
|
||||
/** check that we can't write to _score, its read-only! */
|
||||
public void testDocStore() {
|
||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||
exec("doc = 5; return doc;");
|
||||
});
|
||||
assertTrue(expected.getMessage().contains("Variable [doc] is read-only"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user