27 lines
1,009 B
Scheme
27 lines
1,009 B
Scheme
(import (scheme base)
|
|
(chicken port)
|
|
(srfi-233)
|
|
(test))
|
|
|
|
(test "accumulator"
|
|
"[section1]\nkey1ævalue1\nß acomment\nvaluewithnokey\n[section2]\nkey2ævalue2\n"
|
|
(call-with-output-string
|
|
(lambda (out)
|
|
(let ((my-accumulator (make-ini-file-accumulator out #\æ #\ß)))
|
|
(for-each my-accumulator
|
|
(list (list 'section1 'key1 "value1")
|
|
"acomment"
|
|
(list 'section1 #f "valuewithnokey")
|
|
(list 'section2 'key2 "value2")))))))
|
|
|
|
(test "generator"
|
|
(list (list 'section1 'key1 "value1")
|
|
(list 'section1 #f "valuewithnokey")
|
|
(list 'section2 'key2 "value2"))
|
|
(call-with-input-string
|
|
"[section1]\nkey1øvalue1\nđ acomment\nvaluewithnokey\n[section2]\nkey2øvalue2\n"
|
|
(lambda (in)
|
|
(let ((my-generator (make-ini-file-generator in #\ø #\đ)))
|
|
(port-map identity my-generator)))))
|
|
|
|
(test-exit)
|