lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [07/12] lucenenet git commit: Fixed bugs in the QueryParser.Simple.TestSimpleQueryParser tests that were inverting the logic and testing for enabled rather than disabled option states.
Date Sun, 02 Oct 2016 10:22:18 GMT
Fixed bugs in the QueryParser.Simple.TestSimpleQueryParser tests that were inverting the logic
and testing for enabled rather than disabled option states.


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

Branch: refs/heads/master
Commit: 1757a607b180dd9ebda03ca4261b5939e2fa7d19
Parents: f4f9453
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Sep 22 14:36:21 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Sep 22 14:36:21 2016 +0700

----------------------------------------------------------------------
 .../Simple/TestSimpleQueryParser.cs             | 34 ++++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1757a607/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
index 751d203..f05b467 100644
--- a/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
@@ -605,7 +605,7 @@ namespace Lucene.Net.QueryParsers.Simple
         public void TestDisablePhrase()
         {
             Query expected = new TermQuery(new Term("field", "\"test\""));
-            assertEquals(expected, ParseKeyword("\"test\"", SimpleQueryParser.PHRASE_OPERATOR));
+            assertEquals(expected, ParseKeyword("\"test\"", ~SimpleQueryParser.PHRASE_OPERATOR));
         }
 
         /** test the ability to enable/disable prefix operator */
@@ -613,7 +613,7 @@ namespace Lucene.Net.QueryParsers.Simple
         public void TestDisablePrefix()
         {
             Query expected = new TermQuery(new Term("field", "test*"));
-            assertEquals(expected, ParseKeyword("test*", SimpleQueryParser.PREFIX_OPERATOR));
+            assertEquals(expected, ParseKeyword("test*", ~SimpleQueryParser.PREFIX_OPERATOR));
         }
 
         /** test the ability to enable/disable AND operator */
@@ -621,9 +621,9 @@ namespace Lucene.Net.QueryParsers.Simple
         public void TestDisableAND()
         {
             Query expected = new TermQuery(new Term("field", "foo+bar"));
-            assertEquals(expected, ParseKeyword("foo+bar", SimpleQueryParser.AND_OPERATOR));
+            assertEquals(expected, ParseKeyword("foo+bar", ~SimpleQueryParser.AND_OPERATOR));
             expected = new TermQuery(new Term("field", "+foo+bar"));
-            assertEquals(expected, ParseKeyword("+foo+bar", SimpleQueryParser.AND_OPERATOR));
+            assertEquals(expected, ParseKeyword("+foo+bar", ~SimpleQueryParser.AND_OPERATOR));
         }
 
         /** test the ability to enable/disable OR operator */
@@ -631,9 +631,9 @@ namespace Lucene.Net.QueryParsers.Simple
         public void TestDisableOR()
         {
             Query expected = new TermQuery(new Term("field", "foo|bar"));
-            assertEquals(expected, ParseKeyword("foo|bar", SimpleQueryParser.OR_OPERATOR));
+            assertEquals(expected, ParseKeyword("foo|bar", ~SimpleQueryParser.OR_OPERATOR));
             expected = new TermQuery(new Term("field", "|foo|bar"));
-            assertEquals(expected, ParseKeyword("|foo|bar", SimpleQueryParser.OR_OPERATOR));
+            assertEquals(expected, ParseKeyword("|foo|bar", ~SimpleQueryParser.OR_OPERATOR));
         }
 
         /** test the ability to enable/disable NOT operator */
@@ -641,7 +641,7 @@ namespace Lucene.Net.QueryParsers.Simple
         public void TestDisableNOT()
         {
             Query expected = new TermQuery(new Term("field", "-foo"));
-            assertEquals(expected, ParseKeyword("-foo", SimpleQueryParser.NOT_OPERATOR));
+            assertEquals(expected, ParseKeyword("-foo", ~SimpleQueryParser.NOT_OPERATOR));
         }
 
         /** test the ability to enable/disable precedence operators */
@@ -649,9 +649,9 @@ namespace Lucene.Net.QueryParsers.Simple
         public void TestDisablePrecedence()
         {
             Query expected = new TermQuery(new Term("field", "(foo)"));
-            assertEquals(expected, ParseKeyword("(foo)", SimpleQueryParser.PRECEDENCE_OPERATORS));
+            assertEquals(expected, ParseKeyword("(foo)", ~SimpleQueryParser.PRECEDENCE_OPERATORS));
             expected = new TermQuery(new Term("field", ")foo("));
-            assertEquals(expected, ParseKeyword(")foo(", SimpleQueryParser.PRECEDENCE_OPERATORS));
+            assertEquals(expected, ParseKeyword(")foo(", ~SimpleQueryParser.PRECEDENCE_OPERATORS));
         }
 
         /** test the ability to enable/disable escape operators */
@@ -659,27 +659,27 @@ namespace Lucene.Net.QueryParsers.Simple
         public void TestDisableEscape()
         {
             Query expected = new TermQuery(new Term("field", "foo\\bar"));
-            assertEquals(expected, ParseKeyword("foo\\bar", SimpleQueryParser.ESCAPE_OPERATOR));
-            assertEquals(expected, ParseKeyword("(foo\\bar)", SimpleQueryParser.ESCAPE_OPERATOR));
-            assertEquals(expected, ParseKeyword("\"foo\\bar\"", SimpleQueryParser.ESCAPE_OPERATOR));
+            assertEquals(expected, ParseKeyword("foo\\bar", ~SimpleQueryParser.ESCAPE_OPERATOR));
+            assertEquals(expected, ParseKeyword("(foo\\bar)", ~SimpleQueryParser.ESCAPE_OPERATOR));
+            assertEquals(expected, ParseKeyword("\"foo\\bar\"", ~SimpleQueryParser.ESCAPE_OPERATOR));
         }
 
         [Test]
         public void TestDisableWhitespace()
         {
             Query expected = new TermQuery(new Term("field", "foo foo"));
-            assertEquals(expected, ParseKeyword("foo foo", SimpleQueryParser.WHITESPACE_OPERATOR));
+            assertEquals(expected, ParseKeyword("foo foo", ~SimpleQueryParser.WHITESPACE_OPERATOR));
             expected = new TermQuery(new Term("field", " foo foo\n "));
-            assertEquals(expected, ParseKeyword(" foo foo\n ", SimpleQueryParser.WHITESPACE_OPERATOR));
+            assertEquals(expected, ParseKeyword(" foo foo\n ", ~SimpleQueryParser.WHITESPACE_OPERATOR));
             expected = new TermQuery(new Term("field", "\t\tfoo foo foo"));
-            assertEquals(expected, ParseKeyword("\t\tfoo foo foo", SimpleQueryParser.WHITESPACE_OPERATOR));
+            assertEquals(expected, ParseKeyword("\t\tfoo foo foo", ~SimpleQueryParser.WHITESPACE_OPERATOR));
         }
 
         [Test]
         public void TestDisableFuzziness()
         {
             Query expected = new TermQuery(new Term("field", "foo~1"));
-            assertEquals(expected, ParseKeyword("foo~1", SimpleQueryParser.FUZZY_OPERATOR));
+            assertEquals(expected, ParseKeyword("foo~1", ~SimpleQueryParser.FUZZY_OPERATOR));
         }
 
         [Test]
@@ -692,7 +692,7 @@ namespace Lucene.Net.QueryParsers.Simple
             BooleanQuery expected = new BooleanQuery();
             expected.Add(expectedPhrase, BooleanClause.Occur.MUST);
             expected.Add(new TermQuery(new Term("field", "~2")), BooleanClause.Occur.MUST);
-            assertEquals(expected, Parse("\"foo bar\"~2", SimpleQueryParser.NEAR_OPERATOR));
+            assertEquals(expected, Parse("\"foo bar\"~2", ~SimpleQueryParser.NEAR_OPERATOR));
         }
 
         // we aren't supposed to barf on any input...


Mime
View raw message