Painless: Add public member read/write access test. (#28156)
This commit is contained in:
parent
3fb0cb91a9
commit
5d795afddb
|
@ -26,6 +26,7 @@ import java.util.function.Function;
|
||||||
public class FeatureTest {
|
public class FeatureTest {
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
|
public int z;
|
||||||
|
|
||||||
/** empty ctor */
|
/** empty ctor */
|
||||||
public FeatureTest() {
|
public FeatureTest() {
|
||||||
|
|
|
@ -139,6 +139,7 @@ class org.elasticsearch.index.mapper.IpFieldMapper$IpFieldType$IpScriptDocValues
|
||||||
# for testing.
|
# for testing.
|
||||||
# currently FeatureTest exposes overloaded constructor, field load store, and overloaded static methods
|
# currently FeatureTest exposes overloaded constructor, field load store, and overloaded static methods
|
||||||
class org.elasticsearch.painless.FeatureTest only_fqn {
|
class org.elasticsearch.painless.FeatureTest only_fqn {
|
||||||
|
int z
|
||||||
()
|
()
|
||||||
(int,int)
|
(int,int)
|
||||||
int getX()
|
int getX()
|
||||||
|
|
|
@ -124,4 +124,9 @@ public class BasicAPITests extends ScriptTestCase {
|
||||||
assertEquals("5", exec("int x = 5; return x.toString();"));
|
assertEquals("5", exec("int x = 5; return x.toString();"));
|
||||||
assertEquals(0, exec("int x = 5; return x.compareTo(5);"));
|
assertEquals(0, exec("int x = 5; return x.compareTo(5);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testPublicMemberAccess() {
|
||||||
|
assertEquals(5, exec("org.elasticsearch.painless.FeatureTest ft = new org.elasticsearch.painless.FeatureTest();" +
|
||||||
|
"ft.z = 5; return ft.z;"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue