mirror of https://github.com/apache/lucene.git
LUCENE-5207: Actually test that it works with mixed classloaders
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5207@1523421 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8574686af4
commit
90f2793896
|
@ -197,13 +197,16 @@ public class TestCustomFunctions extends LuceneTestCase {
|
|||
}
|
||||
|
||||
// this should pass:
|
||||
JavascriptCompiler.compile("zeroArgMethod()", functions, child);
|
||||
Expression expr = JavascriptCompiler.compile("zeroArgMethod()", functions, child);
|
||||
assertEquals(5, expr.evaluate(0, null), DELTA);
|
||||
|
||||
// mix foreign and default functions
|
||||
Map<String,Method> mixedFunctions = new HashMap<>(JavascriptCompiler.DEFAULT_FUNCTIONS);
|
||||
mixedFunctions.putAll(functions);
|
||||
JavascriptCompiler.compile("zeroArgMethod()", mixedFunctions, child);
|
||||
JavascriptCompiler.compile("sqrt(20)", mixedFunctions, child);
|
||||
expr = JavascriptCompiler.compile("zeroArgMethod()", mixedFunctions, child);
|
||||
assertEquals(5, expr.evaluate(0, null), DELTA);
|
||||
expr = JavascriptCompiler.compile("sqrt(20)", mixedFunctions, child);
|
||||
assertEquals(Math.sqrt(20), expr.evaluate(0, null), DELTA);
|
||||
try {
|
||||
JavascriptCompiler.compile("zeroArgMethod()", functions, getClass().getClassLoader());
|
||||
fail();
|
||||
|
|
Loading…
Reference in New Issue