@@ -149,6 +149,36 @@ class BasicTests(AbstractQTestCase):
149149 self .assertTrue (e [1 ].startswith ("Bad header row" ))
150150 self .assertTrue ("Column name cannot contain commas" in e [2 ])
151151
152+ self .cleanup (tmpfile )
153+
154+ def test_regexp_int_data_handling (self ):
155+ tmpfile = self .create_file_with_data (sample_data_no_header )
156+
157+ cmd = '../bin/q -d , "select c2 from %s where regexp(\' ^1\' ,c2)"' % tmpfile .name
158+ retcode , o , e = run_command (cmd )
159+
160+ self .assertEquals (retcode , 0 )
161+ self .assertEquals (len (o ), 1 )
162+ self .assertEquals (len (e ), 0 )
163+
164+ self .assertEquals (o [0 ],"1" )
165+
166+ self .cleanup (tmpfile )
167+
168+ def test_regexp_null_data_handling (self ):
169+ tmpfile = self .create_file_with_data (sample_data_no_header )
170+
171+ cmd = '../bin/q -d , "select count(*) from %s where regexp(\' ^\' ,c2)"' % tmpfile .name
172+ retcode , o , e = run_command (cmd )
173+
174+ self .assertEquals (retcode , 0 )
175+ self .assertEquals (len (o ), 1 )
176+ self .assertEquals (len (e ), 0 )
177+
178+ self .assertEquals (o [0 ],"2" )
179+
180+ self .cleanup (tmpfile )
181+
152182 def test_select_one_column (self ):
153183 tmpfile = self .create_file_with_data (sample_data_no_header )
154184
0 commit comments