plist
svn: r13830
This commit is contained in:
parent
7c0273bf47
commit
9657528134
|
@ -2,6 +2,7 @@
|
|||
(require (planet schematics/schemeunit:3)
|
||||
(planet schematics/schemeunit:3/text-ui)
|
||||
xml
|
||||
xml/plist
|
||||
"to-list.ss")
|
||||
|
||||
;; test-bad-read-input : format-str str -> void
|
||||
|
@ -430,16 +431,74 @@
|
|||
|
||||
)
|
||||
|
||||
(local [(define example
|
||||
`(dict (assoc-pair "first-key"
|
||||
"just a string with some whitespace in it")
|
||||
(assoc-pair "second-key"
|
||||
(false))
|
||||
(assoc-pair "third-key"
|
||||
(dict ))
|
||||
(assoc-pair "fourth-key"
|
||||
(dict (assoc-pair "inner-key"
|
||||
(real 3.432))))
|
||||
(assoc-pair "fifth-key"
|
||||
(array (integer 14)
|
||||
"another string"
|
||||
(true)))
|
||||
(assoc-pair "sixth-key"
|
||||
(array))))
|
||||
(define example-str #<<END
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9"><dict><key>first-key</key><string>just a string with some whitespace in it</string><key>second-key</key><false /><key>third-key</key><dict /><key>fourth-key</key><dict><key>inner-key</key><real>3.432</real></dict><key>fifth-key</key><array><integer>14</integer><string>another string</string><true /></array><key>sixth-key</key><array /></dict></plist>
|
||||
END
|
||||
)]
|
||||
(test-suite
|
||||
"PList Library"
|
||||
|
||||
; XXX plist-dict?
|
||||
(test-not-false
|
||||
"plist-dict?"
|
||||
(plist-dict?
|
||||
example))
|
||||
(test-false
|
||||
"plist-dict?"
|
||||
(plist-dict?
|
||||
`(p "Hey")))
|
||||
(test-false
|
||||
"plist-dict?"
|
||||
(plist-dict?
|
||||
`(dict (p "Hey"))))
|
||||
(test-false
|
||||
"plist-dict?"
|
||||
(plist-dict?
|
||||
`(dict (assoc-pair "key" 2 3))))
|
||||
(test-false
|
||||
"plist-dict?"
|
||||
(plist-dict?
|
||||
`(dict (assoc-pair 1 2))))
|
||||
(test-false
|
||||
"plist-dict?"
|
||||
(plist-dict?
|
||||
`(dict (assoc-pair "key" #f))))
|
||||
|
||||
; XXX read-plist
|
||||
(test-equal? "read-plist"
|
||||
(read-plist (open-input-string example-str))
|
||||
example)
|
||||
|
||||
; XXX write-plist
|
||||
(test-equal? "write-plist"
|
||||
(with-output-to-string
|
||||
(lambda ()
|
||||
(write-plist example (current-output-port))))
|
||||
example-str)
|
||||
|
||||
)
|
||||
(local [(define (test-plist-round-trip plist)
|
||||
(define-values (in out) (make-pipe))
|
||||
(write-plist plist out)
|
||||
(close-output-port out)
|
||||
(test-equal? (format "~S" plist) (read-plist in) plist))]
|
||||
(test-plist-round-trip example))
|
||||
|
||||
))
|
||||
|
||||
(test-suite
|
||||
"Legacy tests"
|
||||
|
|
Loading…
Reference in New Issue
Block a user