diff options
author | Urban Müller | 2017-05-22 11:28:58 +0200 |
---|---|---|
committer | Urban Müller | 2017-05-22 11:28:58 +0200 |
commit | f87f1f60381ed063483410d8a5d1fc832c2cb6f4 (patch) | |
tree | cb78e65319a2b3384851c8ddebe05b1bb6ace934 /tests | |
parent | ca8d809d46670a124fed16a14b06505f1ec7a60c (diff) | |
download | itools-f87f1f60381ed063483410d8a5d1fc832c2cb6f4.tar.gz itools-f87f1f60381ed063483410d8a5d1fc832c2cb6f4.tar.bz2 itools-f87f1f60381ed063483410d8a5d1fc832c2cb6f4.zip |
compactify, test fixcolnames
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/it_pipe.t | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/tests/it_pipe.t b/tests/it_pipe.t index 56ee672..e8fa4e8 100755 --- a/tests/it_pipe.t +++ b/tests/it_pipe.t @@ -2,17 +2,10 @@ <?php # csv() -$pipe = new it_pipe(array('data' => array("a\tb", "1\t2"))); -is(json_encode($pipe->csv()), '[{"a":"1","b":"2"}]', "it_pipe::csv()"); - -$pipe = new it_pipe(array('data' => array("a;b", "1;2"))); -is(json_encode($pipe->csv()), '[{"a":"1","b":"2"}]', "it_pipe::csv()"); - -$pipe = new it_pipe(array('data' => array("a,b", "1,2"))); -is(json_encode($pipe->csv()), '[{"a":"1","b":"2"}]', "it_pipe::csv()"); - -$pipe = new it_pipe(array('data' => array("a\tb", "1\t2"))); -is(json_encode($pipe->csv("c,d")), '[{"c":"1","d":"2"}]', "it_pipe::csv()"); - -$pipe = new it_pipe(array('data' => array("\t", "1\t2"))); -is(json_encode($pipe->csv()), '[{"field0":"1","field1":"2"}]', "it_pipe::csv()"); +is(json_encode((new it_pipe(['data' => ["a\tb", "1\t2"]]))->csv()), '[{"a":"1","b":"2"}]'); +is(json_encode((new it_pipe(['data' => ["a;b", "1;2"]]))->csv()), '[{"a":"1","b":"2"}]'); +is(json_encode((new it_pipe(['data' => ["a,b", "1,2"]]))->csv()), '[{"a":"1","b":"2"}]'); +is(json_encode((new it_pipe(['data' => ["\t", "1\t2"]]))->csv()), '[{"field0":"1","field1":"2"}]'); +is(json_encode((new it_pipe(['data' => ["a\tb", "1\t2"]]))->csv("c,d")), '[{"c":"1","d":"2"}]'); +is(json_encode((new it_pipe(['data' => ["a\tb", "1\t2"]]))->csv(['forceschema' => "c,d"])), '[{"c":"1","d":"2"}]'); +is(json_encode((new it_pipe(['data' => ["a b\tb", "1\t2"]]))->csv(['fixcolnames' => true])), '[{"a_b":"1","b":"2"}]'); |