msfl_visitors 1.2.1.dev0 → 1.2.1.dev1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/msfl_visitors/visitor.rb +1 -1
- data/msfl_visitors.gemspec +1 -1
- data/spec/msfl_visitors/visitors/chewy_term_filter_spec.rb +12 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f37f5301f25a83e07f38aab1b3b82ee096d3ca1d
|
4
|
+
data.tar.gz: 609b068eff9ace33c8ef8f7c3b917f5392981143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0d858070bcd4a52e6f9ab10513b60d19e9df46a92d880b42db0231a08cad0aef29c4015b8a752f5bc863785eb346a2c9d50654874ef87a086675bbf3053caf3
|
7
|
+
data.tar.gz: 5a86c87c0942efce43ca92c1822d02ff3a34bcd1776b49b04bc8f86d4b37a5deef56625ef29244ea4c279794b3ccb0d222429154c3ebf6099db134bd0583e22a
|
@@ -101,7 +101,7 @@ module MSFLVisitors
|
|
101
101
|
when Nodes::Match
|
102
102
|
if node.right.is_a? Nodes::Set
|
103
103
|
escaped_str = node.right.contents.map { |right_child| MSFLVisitors::Nodes::Regex.new(right_child.value.to_s).accept(visitor).inspect[3..-4] }.join('|')
|
104
|
-
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} " +
|
104
|
+
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} " + %r[.*#{escaped_str}.*].inspect
|
105
105
|
else
|
106
106
|
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} " + MSFLVisitors::Nodes::Regex.new(node.right.value.to_s).accept(visitor).inspect
|
107
107
|
end
|
data/msfl_visitors.gemspec
CHANGED
@@ -280,12 +280,12 @@ describe MSFLVisitors::Visitor do
|
|
280
280
|
|
281
281
|
context "when the right hand side is a Value node that requires escaping" do
|
282
282
|
|
283
|
-
let(:right) { MSFLVisitors::Nodes::Word.new 'this (
|
283
|
+
let(:right) { MSFLVisitors::Nodes::Word.new 'this (ne&eds) to be* escaped' }
|
284
284
|
|
285
285
|
context "when using the TermFilter visitor" do
|
286
286
|
|
287
|
-
it "results in: 'left =~ /.*this\ \(
|
288
|
-
expect(result).to eq %(lhs =~ ) + /.*this\ \(
|
287
|
+
it "results in: 'left =~ /.*this\ \(ne\&eds\)\ to\ be\*\ escaped.*/'" do
|
288
|
+
expect(result).to eq %(lhs =~ ) + /.*this\ \(ne\&eds\)\ to\ be\*\ escaped.*/.inspect
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
@@ -306,6 +306,15 @@ describe MSFLVisitors::Visitor do
|
|
306
306
|
it "results in: 'left =~ /.*foo|bar|baz.*/'" do
|
307
307
|
expect(result).to eq %(lhs =~ ) + /.*foo|bar|baz.*/.inspect
|
308
308
|
end
|
309
|
+
|
310
|
+
context "when one of the members of the Set requires escaping" do
|
311
|
+
|
312
|
+
let(:foo_node) { MSFLVisitors::Nodes::Word.new "please&*escape me" }
|
313
|
+
|
314
|
+
it "escapes special characters" do
|
315
|
+
expect(result).to eq %(lhs =~ ) + /.*please\&\*escape\ me|bar|baz.*/.inspect
|
316
|
+
end
|
317
|
+
end
|
309
318
|
end
|
310
319
|
|
311
320
|
context "when using the Aggregations visitor" do
|