From 90f2793896ab93750ddb05b43cfe4a9462503f8f Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Sun, 15 Sep 2013 09:06:00 +0000 Subject: [PATCH] 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 --- .../lucene/expressions/js/TestCustomFunctions.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestCustomFunctions.java b/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestCustomFunctions.java index feda8840edf..743f831e621 100644 --- a/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestCustomFunctions.java +++ b/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestCustomFunctions.java @@ -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 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();