From e05e9e86f98a1ee0bb87fecdb54ae7a6ec84b9cf Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Mon, 10 Feb 2020 13:44:55 +0100 Subject: [PATCH] add parser test for word bounded with dash and underscores --- spec/query_parser_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/query_parser_spec.rb b/spec/query_parser_spec.rb index 63356b4..8ab2ac7 100644 --- a/spec/query_parser_spec.rb +++ b/spec/query_parser_spec.rb @@ -450,6 +450,23 @@ class QueryParserTester expect(@result[:DEFAULT_COLUMN]).to eq 'andromeda' end + it 'tests query with multiple search terms with mixed and-or-not after dash and underscore' do + @result = @evaluator.parse('123-and-456 -or-2 -not_not_1') + + @or_array_1 = [ + {:DEFAULT_COLUMN => '-or-2'}, + {:DEFAULT_COLUMN => '-not_not_1'} + ] + + @last_or_array = [ + {:DEFAULT_COLUMN => '123-and-456'}, + {:OPERATOR_OR => @or_array_1} + ] + + expect(@result.length).to eq 1 + expect(@result[:OPERATOR_OR]).to eq @last_or_array + end + it 'tests query with search term in brackets with AND inside word with quotes' do @result = @evaluator.parse('("land")')