diff --git a/fn/csv-to-arrays.xml b/fn/csv-to-arrays.xml index 823d2e9d..f73ad8a8 100644 --- a/fn/csv-to-arrays.xml +++ b/fn/csv-to-arrays.xml @@ -1,4 +1,4 @@ - + Tests for the fn:csv-to-arrays function diff --git a/fn/csv-to-xml.xml b/fn/csv-to-xml.xml index 8d42fe9b..e0a0e497 100644 --- a/fn/csv-to-xml.xml +++ b/fn/csv-to-xml.xml @@ -1,4 +1,4 @@ - + Tests for the fn:csv-to-xml function @@ -547,7 +547,6 @@ fn:csv-to-xml("1,2,3,4|11,12,13,14,15,16", map{'row-delimiter':'|', 'trim-rows':false(), 'header':false()}) - 1234111213141516 + + number-of-columns option causes row padding + + fn:csv-to-xml("1,2,3,4,5,6|14,15,16", + map{'row-delimiter':'|', 'select-columns':1 to 4}) + + 1234141516]]> + + + + + trim-rows option causes row padding + + fn:csv-to-xml("1,2,3,4,5,6|14,15,16", + map{'row-delimiter':'|', 'trim-rows':true()}) + + 123456141516]]> + + + + + trim-rows option with header causes row padding + + fn:csv-to-xml("a,b,c,d,e|1,2,3,4,5|14,15,16", + map{'row-delimiter':'|', 'trim-rows':true(), 'header':true()}) + + abcde12345141516]]> + + + select-columns diff --git a/fn/parse-csv.xml b/fn/parse-csv.xml index e324b008..3a3d9fd6 100644 --- a/fn/parse-csv.xml +++ b/fn/parse-csv.xml @@ -1,4 +1,4 @@ - + Tests for the fn:parse-csv function @@ -652,6 +652,45 @@ "rows":(["1","2","3","4"],["11","12","13","14","15","16"])}) + + + number-of-columns option causes row padding + + fn:parse-csv("1,2,3,4,5,6|14,15,16", + map{'row-delimiter':'|', 'select-columns':1 to 4}) + + deep-equal($result => map:remove("get"), + map{"columns":(), + "column-index": map{}, + "rows":(["1","2","3","4"],["14","15","16",""])}) + + + + + trim-rows option causes row padding + + fn:parse-csv("1,2,3,4,5,6|14,15,16", + map{'row-delimiter':'|', 'trim-rows':true()}) + + deep-equal($result => map:remove("get"), + map{"columns":(), + "column-index": map{}, + "rows":(["1","2","3","4","5","6"],["14","15","16","","",""])}) + + + + + trim-rows option with header causes row padding + + fn:parse-csv("a,b,c,d,e|1,2,3|14,15,16", + map{'row-delimiter':'|', 'trim-rows':true(), 'header':true()}) + + deep-equal($result => map:remove("get"), + map{"columns":("a","b","c","d","e"), + "column-index": map{"a":1,"b":2,"c":3,"d":4,"e":5}, + "rows":(["1","2","3","",""],["14","15","16","",""])}) + + select-columns