NightOwl888 commented on code in PR #1205:
URL: https://github.com/apache/lucenenet/pull/1205#discussion_r2404932740


##########
src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs:
##########
@@ -510,6 +511,40 @@ public void TestSimpleNumericQuery()
             AssertSimpleQuery(NumberType.NEGATIVE, 1);
         }
 
+        /// <summary>
+        /// Tests the fix for Lucene.NET GitHub issue #846.
+        /// Numeric values were failing for cultures that use a Unicode minus 
sign
+        /// (U+2212) rather than a hyphen-minus (U+002D) in exponential 
notation.
+        /// This was due to a bug in J2N (#128) that has since been fixed.
+        /// </summary>
+        /// <remarks>
+        /// https://github.com/NightOwl888/J2N/issues/128
+        /// </remarks>
+        [Test]
+        [LuceneNetSpecific]
+        public void TestInclusiveNumericRange_UnicodeMinus()
+        {
+            // Use a culture that uses a Unicode minus sign rather than a 
hyphen-minus
+            // in exponential notation.
+            LOCALE = new CultureInfo("sv-FI");
+            CultureInfo.CurrentCulture = LOCALE;

Review Comment:
   The test framework sets the `CultureInfo.CurrentCulture` when initializing 
each class. So, this could potentially pollute that state in other tests in 
this class (if not now, in the future).
   
   Let's use the `J2N.Globalization.CultureContext` class here to roll back 
this culture change at the end of the method rather than setting 
`CultureInfo.CurrentCulture` directly.
   
   ```c#
   using context = new CultureContext(LOCALE);
   ```
   
   Do note that it may be clearer to use the block style `using` syntax to 
demonstrate that the culture applies for the entire block.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to