lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [2/5] lucenenet git commit: Lucene.Net.Tests.QueryParser.Messages.TestNLS.TestNLSLoading_xx_XX: Always ignore the test if CultureNotFoundException is thrown, rather than just on .NET Core
Date Mon, 10 Apr 2017 14:38:23 GMT
Lucene.Net.Tests.QueryParser.Messages.TestNLS.TestNLSLoading_xx_XX: Always ignore the test
if CultureNotFoundException is thrown, rather than just on .NET Core


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/67f31ac4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/67f31ac4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/67f31ac4

Branch: refs/heads/api-work
Commit: 67f31ac4aefda7c2ea39ff0d29998c15d5b5375a
Parents: 035f680
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Apr 10 16:55:41 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Apr 10 16:55:41 2017 +0700

----------------------------------------------------------------------
 .../Flexible/Messages/TestNLS.cs                | 50 +++++++++++---------
 1 file changed, 28 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/67f31ac4/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
index a781d05..2e31669 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
@@ -84,29 +84,35 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
         [Test]
         public void TestNLSLoading_xx_XX()
         {
-            // LUCENENET NOTE: .NET Core throws a CultureNotFoundException in this case.
-            // There doesn't seem to be a reasonable way to test this as a result.
-#if !NETSTANDARD
-            CultureInfo locale = new CultureInfo("xx-XX");
-            String message = NLS.GetLocalizedMessage(
-                MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION,
-                locale);
-            /* 
-             * if the default locale is ja, you get ja as a fallback:
-             * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
-             */
-            if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
-                assertEquals("Truncated unicode escape sequence.", message);
+            try
+            {
+                CultureInfo locale = new CultureInfo("xx-XX");
+                String message = NLS.GetLocalizedMessage(
+                    MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION,
+                    locale);
+                /* 
+                 * if the default locale is ja, you get ja as a fallback:
+                 * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale,
java.lang.ClassLoader)
+                 */
+                if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
+                    assertEquals("Truncated unicode escape sequence.", message);
 
-            message = NLS.GetLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX,
-                locale, "XXX");
-            /* 
-             * if the default locale is ja, you get ja as a fallback:
-             * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
-             */
-            if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
-                assertEquals("Syntax Error: XXX", message);
-#endif
+                message = NLS.GetLocalizedMessage(MessagesTestBundle.Q0001E_INVALID_SYNTAX,
+                    locale, "XXX");
+                /* 
+                 * if the default locale is ja, you get ja as a fallback:
+                 * see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale,
java.lang.ClassLoader)
+                 */
+                if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
+                    assertEquals("Syntax Error: XXX", message);
+            }
+            catch (CultureNotFoundException)
+            {
+                // ignore
+
+                // LUCENENET NOTE: .NET Core throws a CultureNotFoundException in this case.
+                // There doesn't seem to be a reasonable way to test this as a result.
+            }
         }
 
         [Test]


Mime
View raw message