diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCharBlockArray.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCharBlockArray.cs index 8b2c667714..b30010a64c 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCharBlockArray.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCharBlockArray.cs @@ -44,9 +44,9 @@ public virtual void TestArray() // CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder() // .onUnmappableCharacter(CodingErrorAction.REPLACE) // .onMalformedInput(CodingErrorAction.REPLACE); - // - // Encoding decoder = Encoding.GetEncoding(Encoding.UTF8.CodePage, - // new EncoderReplacementFallback("?"), + // + // Encoding decoder = Encoding.GetEncoding(Encoding.UTF8.CodePage, + // new EncoderReplacementFallback("?"), // new DecoderReplacementFallback("?")); for (int i = 0; i < n; i++) @@ -247,6 +247,11 @@ public virtual void TestAppendableInterface() expected = t.ToString(); t.Append((char[])null); // No-op Assert.AreEqual(expected, t.ToString()); + + // LUCENENET specific - test ReadOnlySpan overload + t = new CharBlockArray(); + t.Append("12345678".AsSpan()); + Assert.AreEqual("12345678", t.ToString()); } // LUCENENET: Borrowed this test from TestCharTermAttributeImpl @@ -285,6 +290,11 @@ public virtual void TestAppendableInterfaceWithLongSequences() const string longTestString = "012345678901234567890123456789"; t.Append(new CharSequenceAnonymousClass(longTestString)); Assert.AreEqual("4567890123456" + longTestString, t.ToString()); + + // LUCENENET specific - test ReadOnlySpan overload + t = new CharBlockArray(); + t.Append("01234567890123456789012345678901234567890123456789".AsSpan()); + Assert.AreEqual("01234567890123456789012345678901234567890123456789", t.ToString()); } private sealed class CharSequenceAnonymousClass : ICharSequence @@ -319,4 +329,4 @@ public override string ToString() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs b/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs index cd0b951c9e..6580a3dd23 100644 --- a/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs +++ b/src/Lucene.Net.Tests/Analysis/TokenAttributes/TestCharTermAttributeImpl.cs @@ -305,6 +305,10 @@ public virtual void TestAppendableInterface() expected = t.ToString(); t.Append((char[])null); // No-op Assert.AreEqual(expected, t.ToString()); + + // LUCENENET specific - test ReadOnlySpan overload + t.SetEmpty().Append("12345678".AsSpan()); + Assert.AreEqual("12345678", t.ToString()); } [Test] @@ -341,6 +345,10 @@ public virtual void TestAppendableInterfaceWithLongSequences() const string longTestString = "012345678901234567890123456789"; t.Append(new CharSequenceAnonymousClass(this, longTestString)); Assert.AreEqual("4567890123456" + longTestString, t.ToString()); + + // LUCENENET specific - test ReadOnlySpan overload + t.SetEmpty().Append("01234567890123456789012345678901234567890123456789".AsSpan()); + Assert.AreEqual("01234567890123456789012345678901234567890123456789", t.ToString()); } private sealed class CharSequenceAnonymousClass : ICharSequence @@ -479,4 +487,4 @@ public void testAppendPerf() { */ } -} \ No newline at end of file +}