This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 02d9671794b4cf1cdb5bed06be24f929f9a573c5 Author: Shad Storhaug <[email protected]> AuthorDate: Sat Aug 3 20:08:48 2019 +0700 BUG: Lucene.Net.Tests.Support.TestTreeSet: Passing null instead of CultureInfo.InvariantCulture causes the test to randomly fail depending on the culture of the current thread (which is randomly selected by LuceneTestCase). --- src/Lucene.Net.Tests/Support/TestTreeSet.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Lucene.Net.Tests/Support/TestTreeSet.cs b/src/Lucene.Net.Tests/Support/TestTreeSet.cs index 448e27c..156343e 100644 --- a/src/Lucene.Net.Tests/Support/TestTreeSet.cs +++ b/src/Lucene.Net.Tests/Support/TestTreeSet.cs @@ -20,6 +20,7 @@ */ using System; +using System.Globalization; using Lucene.Net.Attributes; using Lucene.Net.Support.C5; using NUnit.Framework; @@ -67,9 +68,14 @@ namespace Lucene.Net.Support.RBTreeSet { Assert.AreEqual("{ }", coll.ToString()); coll.AddAll(new int[] { -4, 28, 129, 65530 }); - Assert.AreEqual("{ -4, 28, 129, 65530 }", coll.ToString()); + // LUCENENET specific - LuceneTestCase swaps cultures at random, therefore + // we require the IFormatProvider to be passed to make this test stable. + Assert.AreEqual("{ -4, 28, 129, 65530 }", coll.ToString(null, CultureInfo.InvariantCulture)); Assert.AreEqual("{ -4, 1C, 81, FFFA }", coll.ToString(null, rad16)); - Assert.AreEqual("{ -4, 28, 129... }", coll.ToString("L14", null)); + // LUCENENET specific - LuceneTestCase swaps cultures at random, therefore + // passing a null here will have random results, making the comparison fail under + // certain cultures. We fix this by passing CultureInfo.InvariantCulture instead of null. + Assert.AreEqual("{ -4, 28, 129... }", coll.ToString("L14", CultureInfo.InvariantCulture)); Assert.AreEqual("{ -4, 1C, 81... }", coll.ToString("L14", rad16)); } }
