dsmiley commented on a change in pull request #1877: URL: https://github.com/apache/lucene-solr/pull/1877#discussion_r492226769
########## File path: solr/core/src/test/org/apache/solr/request/macro/TestMacroExpander.java ########## @@ -143,15 +142,31 @@ public void testMapExprExpandOn() { String oldVal = System.getProperty("StreamingExpressionMacros","false"); System.setProperty("StreamingExpressionMacros", "true"); try { - @SuppressWarnings({"rawtypes"}) - Map expanded = MacroExpander.expand(request); - assertEquals("zero", ((String[])expanded.get("fq"))[0]); - assertEquals("one", ((String[])expanded.get("fq"))[1]); - assertEquals("two", ((String[]) expanded.get("fq"))[2]); - assertEquals("three", ((String[]) expanded.get("fq"))[3]); - assertEquals("one", ((String[])expanded.get("expr"))[0]); + Map<String, String[]> expanded = MacroExpander.expand(request); + assertEquals("zero", expanded.get("fq")[0]); + assertEquals("one", expanded.get("fq")[1]); + assertEquals("two", expanded.get("fq")[2]); + assertEquals("three", expanded.get("fq")[3]); + assertEquals("one", expanded.get("expr")[0]); } finally { System.setProperty("StreamingExpressionMacros", oldVal); } } + + @Test + public void testUnbalanced() { // SOLR-13181 + final MacroExpander meSkipOnMissingParams = new MacroExpander(Collections.emptyMap()); + final MacroExpander meFailOnMissingParams = new MacroExpander(Collections.emptyMap(), true); + assertEquals("${noClose", meSkipOnMissingParams.expand("${noClose")); Review comment: I'm not 100% clear what you suggest; let me try to guess. Let's say the parameter map has exactly one param == goodAnswer with value 42. ```` assertEquals("42", meSkipOnMissingParams.expand("${goodAnswer}")); assertEquals("42", meFailOnMissingParams.expand("${goodAnswer}")); ```` Is that what you suggest? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org