summaryrefslogtreecommitdiff
path: root/tests/it_pipe.t
diff options
context:
space:
mode:
authorUrban Müller2014-01-09 14:25:57 +0100
committerUrban Müller2014-01-09 14:25:57 +0100
commit6022d924c7ac70a13d1782f2f1199f9ef45c947c (patch)
tree6b2ee8819a3f6c28ce8c83cc8c0659bfccae8703 /tests/it_pipe.t
parent8a0e96d7dcce898f6c6637c608312484cacfe38b (diff)
downloaditools-6022d924c7ac70a13d1782f2f1199f9ef45c947c.tar.gz
itools-6022d924c7ac70a13d1782f2f1199f9ef45c947c.tar.bz2
itools-6022d924c7ac70a13d1782f2f1199f9ef45c947c.zip
allow column name override, add tests
Diffstat (limited to 'tests/it_pipe.t')
-rwxr-xr-xtests/it_pipe.t7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/it_pipe.t b/tests/it_pipe.t
new file mode 100755
index 0000000..c65073d
--- /dev/null
+++ b/tests/it_pipe.t
@@ -0,0 +1,7 @@
+#!/www/server/bin/php
+<?php
+
+is(json_encode((new it_pipe('data' => array("a\tb", "1\t2")))->csv()), '[{"a":"1","b":"2"}]', "it_pipe::csv()");
+is(json_encode((new it_pipe('data' => array("a;b", "1;2")))->csv()), '[{"a":"1","b":"2"}]', "it_pipe::csv()");
+is(json_encode((new it_pipe('data' => array("a,b", "1,2")))->csv()), '[{"a":"1","b":"2"}]', "it_pipe::csv()");
+is(json_encode((new it_pipe('data' => array("a\tb", "1\t2")))->csv("c,d")), '[{"c":"1","d":"2"}]', "it_pipe::csv()");