Add csv simple tests.
This commit is contained in:
parent
a00b0f6239
commit
a9c21c6cb0
3 changed files with 19 additions and 3 deletions
|
@ -29,13 +29,15 @@
|
|||
csv-simple
|
||||
(
|
||||
csv-parse
|
||||
csv-simple-tests!
|
||||
)
|
||||
|
||||
(import scheme
|
||||
(chicken base)
|
||||
(chicken keyword)
|
||||
(chicken io)
|
||||
(chicken irregex))
|
||||
(chicken irregex)
|
||||
testing)
|
||||
|
||||
;; Curry version of line parser with configurable cell separator and
|
||||
;; string delimiter. Returns a list of lists of strings.
|
||||
|
@ -84,5 +86,17 @@
|
|||
(csv-parse-line (make-csv-line-parser separator string-delimiter)))
|
||||
(map csv-parse-line lines)))
|
||||
|
||||
;; Module self-tests
|
||||
(define (csv-simple-tests!)
|
||||
(run-tests
|
||||
csv-simple
|
||||
(test-equal? csv-parse-line
|
||||
((make-csv-line-parser ";" "\"") "test;2;3")
|
||||
'("test" "2" "3"))
|
||||
(test-equal? csv-parse-line
|
||||
((make-csv-line-parser ";" "\"") "test;\"2;quoted\";3")
|
||||
'("test" "2;quoted" "3"))
|
||||
))
|
||||
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue