diff options
author | Harel Ben-Attia <harelba@gmail.com> | 2014-05-20 04:09:22 -0400 |
---|---|---|
committer | Harel Ben-Attia <harelba@gmail.com> | 2014-05-20 04:09:22 -0400 |
commit | 39a5df16db507a41c937da393340a01fe9607c06 (patch) | |
tree | 25a304bbb5762c3d9f49a5a1a77c21aa8cd3c57b /run-tests | |
parent | 1606f34f8466e13b542a89983e1b61d1d5cddde8 (diff) |
Added -T flag for tab delimited output
Diffstat (limited to 'run-tests')
-rwxr-xr-x | run-tests | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -149,6 +149,20 @@ class BasicTests(AbstractQTestCase): self.cleanup(tmpfile) + def test_tab_delimition_parameter__with_manual_override_attempt(self): + tmpfile = self.create_file_with_data(sample_data_no_header.replace(",","\t")) + cmd = './q -t -d , "select c1,c2,c3 from %s"' % tmpfile.name + retcode,o,e = run_command(cmd) + + self.assertEquals(retcode,0) + self.assertEquals(len(o),3) + self.assertEquals(len(e),0) + self.assertEquals(o[0],sample_data_rows[0].replace(",","\t")) + self.assertEquals(o[1],sample_data_rows[1].replace(",","\t")) + self.assertEquals(o[2],sample_data_rows[2].replace(",","\t")) + + self.cleanup(tmpfile) + def test_output_delimiter(self): tmpfile = self.create_file_with_data(sample_data_no_header) cmd = './q -d , -D "|" "select c1,c2,c3 from %s"' % tmpfile.name @@ -164,6 +178,36 @@ class BasicTests(AbstractQTestCase): self.cleanup(tmpfile) + def test_output_delimiter_tab_parameter(self): + tmpfile = self.create_file_with_data(sample_data_no_header) + cmd = './q -d , -T "select c1,c2,c3 from %s"' % tmpfile.name + retcode,o,e = run_command(cmd) + + self.assertEquals(retcode,0) + self.assertEquals(len(o),3) + self.assertEquals(len(e),0) + + self.assertEquals(o[0],sample_data_rows[0].replace(",","\t")) + self.assertEquals(o[1],sample_data_rows[1].replace(",","\t")) + self.assertEquals(o[2],sample_data_rows[2].replace(",","\t")) + + self.cleanup(tmpfile) + + def test_output_delimiter_tab_parameter__with_manual_override_attempt(self): + tmpfile = self.create_file_with_data(sample_data_no_header) + cmd = './q -d , -T -D "|" "select c1,c2,c3 from %s"' % tmpfile.name + retcode,o,e = run_command(cmd) + + self.assertEquals(retcode,0) + self.assertEquals(len(o),3) + self.assertEquals(len(e),0) + + self.assertEquals(o[0],sample_data_rows[0].replace(",","\t")) + self.assertEquals(o[1],sample_data_rows[1].replace(",","\t")) + self.assertEquals(o[2],sample_data_rows[2].replace(",","\t")) + + self.cleanup(tmpfile) + def test_stdin_input(self): cmd = 'printf "%s" | ./q -d , "select c1,c2,c3 from -"' % sample_data_no_header retcode,o,e = run_command(cmd) |