@@ -269,6 +269,46 @@ class RSQLParserTest extends Specification {
269269 ex. cause instanceof UnknownOperatorException
270270 }
271271
272+ def ' Should parse empty multi-argument operators' () {
273+ expect :
274+ parse(input) == expected
275+
276+ where :
277+ input | expected
278+ ' s0=in=()' | ' in' (' s0' )
279+ ' s0=in=( )' | ' in' (' s0' )
280+ ' s0=out=()' | out(' s0' )
281+ ' s0=out=( )' | out(' s0' )
282+ }
283+
284+
285+ def ' Should parse multi-argument operators with whitespaces values' () {
286+ expect :
287+ parse(input) == expected
288+
289+ where :
290+ input | expected
291+ " s0=in=(' ')" | ' in' (' s0' , ' ' )
292+ " s0=in=(' ')" | ' in' (' s0' , ' ' )
293+ " s0=in=(' ',' ')" | ' in' (' s0' , ' ' , ' ' )
294+ " s0=in=(' ' or ' ')" | ' in' (' s0' , ' ' , ' ' )
295+ " s0=in=(' ',' ',' ')" | ' in' (' s0' , ' ' , ' ' , ' ' )
296+ " s0=out=(' ')" | ' out' (' s0' , ' ' )
297+ " s0=out=(' ')" | ' out' (' s0' , ' ' )
298+ " s0=out=(' ' or ' ')" | ' out' (' s0' , ' ' , ' ' )
299+ " s0=out=(' ',' ',' ')" | ' out' (' s0' , ' ' , ' ' , ' ' )
300+ }
301+
302+ def ' Should throw when coma separated args contains only coma' () {
303+ when :
304+ parse(input)
305+
306+ then :
307+ thrown RSQLParserException
308+
309+ where :
310+ input << [ ' s0=in=( , )' , ' s0=in=( or )' ]
311+ }
272312
273313 // ////// Helpers ////////
274314
@@ -277,6 +317,7 @@ class RSQLParserTest extends Specification {
277317 def and (Node ... nodes ) { new AndNode (nodes as List ) }
278318 def or (Node ... nodes ) { new OrNode (nodes as List ) }
279319 def eq (sel , arg ) { new ComparisonNode (EQUAL , sel, [arg as String ]) }
320+ def ' in' (sel, .. . args) { new ComparisonNode (IN , sel, args as List ) }
280321 def out (sel , ...args ) { new ComparisonNode (NOT_IN , sel, args as List ) }
281322 def isNull (sel ) { new ComparisonNode (IS_NULL , sel, []) }
282323 def notNull (sel ) { new ComparisonNode (NOT_NULL , sel, []) }
0 commit comments