-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.zp
49 lines (40 loc) · 1.45 KB
/
test.zp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(load "csv")
(load "minitest/minitest")
(define csv:read (import "csv:read"))
(define csv:write (import "csv:write"))
(define minitest:assert-equal (import "minitest:assert-equal"))
((import "minitest:colorize") #t)
((import "minitest:verbose") #t)
(minitest:assert-equal
[("a" "b") ("1" "2") ("3" "4")]
(csv:read "a,b\n1,2\n3,4")
"test that we can read in csv data")
(minitest:assert-equal
[("a,b" "b") ("1" "2") ("3" "4")]
(csv:read "\"a,b\",b\n1,2\n3,4")
"test that we can read in quoted csv data")
(minitest:assert-equal
[("a" "b") ("1" "2,2") ("3" "4")]
(csv:read "a,b\n1,\"2,2\"\n3,4")
"test that we can read in quoted csv data when quoting is at any position")
(minitest:assert-equal
[("a" "b") ("1" "2-2") ("3" "4")]
(csv:read "a-b\n1-\"2-2\"\n3-4" #{:separator #\-})
"test that we can read in csv data with custom separator")
(minitest:assert-equal
"a,b\n1,22\n3,4"
(csv:write [("a" "b") ("1" "22") ("3" "4")])
"test that we can write out csv data")
(minitest:assert-equal
"a,b\n1,\"2,2\"\n3,4"
(csv:write [("a" "b") ("1" "2,2") ("3" "4")])
"test that we can write out quoted csv data")
(minitest:assert-equal
"a,b\n1,\"2,2\"\n3,4"
(csv:write [("a" "b") ("1" "2,2") ("3" "4")])
"test that we can write out quoted csv data")
(minitest:assert-equal
"alb\n1l2\n3l4"
(csv:write [("a" "b") ("1" "2") ("3" "4")] #{:separator #\l})
"test that we can write out csv data with custom separator")
((import "minitest:results"))