lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: Fixing test failures
Date Sat, 16 Jul 2016 23:52:44 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/analysis-work 2561993d7 -> 0c794a36c


Fixing test failures



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

Branch: refs/heads/analysis-work
Commit: 0c794a36cf35687efaa9ebedc7544e59d2eb1dbc
Parents: 2561993
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Jul 17 02:51:40 2016 +0300
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Jul 17 02:51:40 2016 +0300

----------------------------------------------------------------------
 .../Analysis/Util/CharArrayMap.cs                 |  9 +++++----
 .../Analysis/Util/TestCharArrayMap.cs             | 10 +++++-----
 .../Analysis/Util/TestCharArraySet.cs             | 18 +++++++++---------
 3 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c794a36/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
index d7fc4ab..25a8d35 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
@@ -358,7 +358,7 @@ namespace Lucene.Net.Analysis.Util
             return true;
         }
 
-        private bool Equals(ICharSequence text1, char[] text2)
+        private bool Equals(string text1, char[] text2)
         {
             int len = text1.Length;
             if (len != text2.Length)
@@ -381,7 +381,7 @@ namespace Lucene.Net.Analysis.Util
             {
                 for (int i = 0; i < len; i++)
                 {
-                    if (text1.CharAt(i) != text2[i])
+                    if (text1[i] != text2[i])
                     {
                         return false;
                     }
@@ -421,8 +421,9 @@ namespace Lucene.Net.Analysis.Util
         {
             if (text == null)
             {
-                throw new ArgumentException("text can't be null", "text");
+                throw new ArgumentException("text can't be null", nameof(text));
             }
+
             int code = 0;
             int len = text.Length;
             if (ignoreCase)
@@ -483,7 +484,7 @@ namespace Lucene.Net.Analysis.Util
 
         public IEnumerator<KeyValuePair<object, V>> GetEnumerator()
         {
-            throw new NotImplementedException();
+            throw new NotSupportedException();
         }
 
         public override string ToString()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c794a36/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArrayMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArrayMap.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArrayMap.cs
index 4b3cc0e..80f094a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArrayMap.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArrayMap.cs
@@ -149,9 +149,9 @@ namespace Lucene.Net.Tests.Analysis.Common.Analysis.Util
 //        }
 
         [Test]
-        public virtual void TestModifyOnUnmodifiable()
+        public void TestModifyOnUnmodifiable()
         {
-            CharArrayMap<int> map = new CharArrayMap<int>(TEST_VERSION_CURRENT,
2, false);
+            CharArrayMap<int?> map = new CharArrayMap<int?>(TEST_VERSION_CURRENT,
2, false);
             map.Put("foo", 1);
             map.Put("bar", 2);
             int size = map.Count;
@@ -161,9 +161,9 @@ namespace Lucene.Net.Tests.Analysis.Common.Analysis.Util
             assertTrue(map.ContainsKey("bar"));
             assertEquals(2, map.Get("bar"));
 
-            map = CharArrayMap<int>.UnmodifiableMap(map);
+            map = CharArrayMap<int?>.UnmodifiableMap(map);
             assertEquals("Map size changed due to unmodifiableMap call", size, map.Count);
-            string NOT_IN_MAP = "SirGallahad";
+            var NOT_IN_MAP = "SirGallahad";
             assertFalse("Test String already exists in map", map.ContainsKey(NOT_IN_MAP));
             assertNull("Test String already exists in map", map.Get(NOT_IN_MAP));
 
@@ -219,7 +219,7 @@ namespace Lucene.Net.Tests.Analysis.Common.Analysis.Util
 
             try
             {
-                map.EntrySet().Clear();
+                map.GetEntrySet().Clear();
                 fail("Modified unmodifiable map");
             }
             catch (System.NotSupportedException)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c794a36/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
index 26a34e3..8f9b461 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
@@ -85,18 +85,18 @@ namespace Lucene.Net.Tests.Analysis.Common.Analysis.Util
         [Test]
         public virtual void TestClear()
         {
-            CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 10, true);
+            var set = new CharArraySet(TEST_VERSION_CURRENT, 10, true);
             set.AddAll(TEST_STOP_WORDS);
             assertEquals("Not all words added", TEST_STOP_WORDS.Length, set.size());
             set.Clear();
             assertEquals("not empty", 0, set.size());
-            for (int i = 0; i < TEST_STOP_WORDS.Length; i++)
+            for (var i = 0; i < TEST_STOP_WORDS.Length; i++)
             {
                 assertFalse(set.Contains(TEST_STOP_WORDS[i]));
             }
             set.AddAll(TEST_STOP_WORDS);
             assertEquals("Not all words added", TEST_STOP_WORDS.Length, set.size());
-            for (int i = 0; i < TEST_STOP_WORDS.Length; i++)
+            for (var i = 0; i < TEST_STOP_WORDS.Length; i++)
             {
                 assertTrue("Set doesn't contain " + TEST_STOP_WORDS[i], set.Contains(TEST_STOP_WORDS[i]));
             }
@@ -215,21 +215,21 @@ namespace Lucene.Net.Tests.Analysis.Common.Analysis.Util
         }
 
         [Test]
-        public virtual void testUnmodifiableSet()
+        public virtual void TestUnmodifiableSet()
         {
-            CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 10, true);
-            set.addAll(TEST_STOP_WORDS);
-            set.add(Convert.ToInt32(1));
+            var set = new CharArraySet(TEST_VERSION_CURRENT, 10, true);
+            set.AddAll(TEST_STOP_WORDS);
+            set.Add(Convert.ToInt32(1));
             int size = set.size();
             set = CharArraySet.UnmodifiableSet(set);
             assertEquals("Set size changed due to unmodifiableSet call", size, set.size());
-            foreach (string stopword in TEST_STOP_WORDS)
+            foreach (var stopword in TEST_STOP_WORDS)
             {
                 assertTrue(set.contains(stopword));
             }
             assertTrue(set.contains(Convert.ToInt32(1)));
             assertTrue(set.contains("1"));
-            assertTrue(set.contains(new char[] { '1' }));
+            assertTrue(set.contains(new[] { '1' }));
 
             try
             {


Mime
View raw message