Blame lenses/tests/test_csv.aug
|
Packit Service |
a2ae7a |
module Test_CSV =
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Simple test *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get "a,b,c\n" =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "1" = "a" }
|
|
Packit Service |
a2ae7a |
{ "2" = "b" }
|
|
Packit Service |
a2ae7a |
{ "3" = "c" } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Values with spaces *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get "a,b c,d\n" =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "1" = "a" }
|
|
Packit Service |
a2ae7a |
{ "2" = "b c" }
|
|
Packit Service |
a2ae7a |
{ "3" = "d" } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Quoted values *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get "a,\"b,c\",d
|
|
Packit Service |
a2ae7a |
# comment
|
|
Packit Service |
a2ae7a |
#
|
|
Packit Service |
a2ae7a |
e,f,with space\n" =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "1" = "a" }
|
|
Packit Service |
a2ae7a |
{ "2" = "\"b,c\"" }
|
|
Packit Service |
a2ae7a |
{ "3" = "d" } }
|
|
Packit Service |
a2ae7a |
{ "#comment" = "comment" }
|
|
Packit Service |
a2ae7a |
{ }
|
|
Packit Service |
a2ae7a |
{ "2"
|
|
Packit Service |
a2ae7a |
{ "1" = "e" }
|
|
Packit Service |
a2ae7a |
{ "2" = "f" }
|
|
Packit Service |
a2ae7a |
{ "3" = "with space" } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Empty values *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get ",
|
|
Packit Service |
a2ae7a |
,,\n" =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "1" = "" }
|
|
Packit Service |
a2ae7a |
{ "2" = "" } }
|
|
Packit Service |
a2ae7a |
{ "2"
|
|
Packit Service |
a2ae7a |
{ "1" = "" }
|
|
Packit Service |
a2ae7a |
{ "2" = "" }
|
|
Packit Service |
a2ae7a |
{ "3" = "" } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Trailing spaces *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get "a , b
|
|
Packit Service |
a2ae7a |
\n" =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "1" = "a " }
|
|
Packit Service |
a2ae7a |
{ "2" = " b " } }
|
|
Packit Service |
a2ae7a |
{ "2"
|
|
Packit Service |
a2ae7a |
{ "1" = " " } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Quoted values in quoted values *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get "\"a,b\"\"c d\"\"\"\n" =
|
|
Packit Service |
a2ae7a |
{ "1" { "1" = "\"a,b\"\"c d\"\"\"" } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Quote in quoted values *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get "\"a,b\"\"c d\"\n" =
|
|
Packit Service |
a2ae7a |
{ "1" { "1" = "\"a,b\"\"c d\"" } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns
|
|
Packit Service |
a2ae7a |
Values with newlines *)
|
|
Packit Service |
a2ae7a |
test CSV.lns get "a,\"b\n c\"\n" =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "1" = "a" }
|
|
Packit Service |
a2ae7a |
{ "2" = "\"b\n c\"" } }
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Test: CSV.lns_semicol
|
|
Packit Service |
a2ae7a |
Semi-colon lens *)
|
|
Packit Service |
a2ae7a |
test CSV.lns_semicol get "a;\"b;c\";d
|
|
Packit Service |
a2ae7a |
# comment
|
|
Packit Service |
a2ae7a |
#
|
|
Packit Service |
a2ae7a |
e;f;with space\n" =
|
|
Packit Service |
a2ae7a |
{ "1"
|
|
Packit Service |
a2ae7a |
{ "1" = "a" }
|
|
Packit Service |
a2ae7a |
{ "2" = "\"b;c\"" }
|
|
Packit Service |
a2ae7a |
{ "3" = "d" } }
|
|
Packit Service |
a2ae7a |
{ "#comment" = "comment" }
|
|
Packit Service |
a2ae7a |
{ }
|
|
Packit Service |
a2ae7a |
{ "2"
|
|
Packit Service |
a2ae7a |
{ "1" = "e" }
|
|
Packit Service |
a2ae7a |
{ "2" = "f" }
|
|
Packit Service |
a2ae7a |
{ "3" = "with space" } }
|
|
Packit Service |
a2ae7a |
|