From 0b1617c52b78449a378b4d03858b89eb28a19061 Mon Sep 17 00:00:00 2001 From: Marvin Justice Date: Tue, 5 Mar 2024 10:50:44 -0500 Subject: [PATCH] Test case that exposes bug in PR #11724 --- .../analysis/charfilter/TestHTMLStripCharFilter.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestHTMLStripCharFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestHTMLStripCharFilter.java index d5122406261..6253517f457 100644 --- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestHTMLStripCharFilter.java +++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestHTMLStripCharFilter.java @@ -33,6 +33,7 @@ import org.apache.lucene.index.IndexWriter; import org.apache.lucene.tests.analysis.BaseTokenStreamTestCase; import org.apache.lucene.tests.analysis.MockTokenizer; import org.apache.lucene.tests.util.TestUtil; +import org.junit.Ignore; public class TestHTMLStripCharFilter extends BaseTokenStreamTestCase { @@ -649,6 +650,17 @@ public class TestHTMLStripCharFilter extends BaseTokenStreamTestCase { assertEquals("Test\n\n\n\nSome text.", result.toString().trim()); } + @Ignore("Fails due to PR #11724") + public void testForIssue10520Regression() throws IOException { + String test = + "Testa link some text another link"; + Reader reader = new StringReader(test); + HTMLStripCharFilter filter = new HTMLStripCharFilter(reader); + StringWriter result = new StringWriter(); + filter.transferTo(result); + assertEquals("Test\n\na link some text another link", result.toString().trim()); + } + public static void assertHTMLStripsTo(String input, String gold, Set escapedTags) throws Exception { assertHTMLStripsTo(new StringReader(input), gold, escapedTags);