mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Add tests
This commit is contained in:
parent
3745c16c8c
commit
6693e6bf18
1 changed files with 34 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
(export run-tests)
|
||||
(begin
|
||||
(define (run-tests)
|
||||
(test-begin "json")
|
||||
(test-begin "json-parse")
|
||||
(test 1 (parse-json "1"))
|
||||
(test 1.5 (parse-json "1.5"))
|
||||
(test 1000.0 (parse-json "1e3"))
|
||||
|
@ -67,4 +67,37 @@
|
|||
]
|
||||
}
|
||||
}}"))
|
||||
(test-end)
|
||||
(test-begin "json-unparse")
|
||||
(test "1" (unparse-json 1))
|
||||
(test "1.5" (unparse-json 1.5))
|
||||
(test "1000" (unparse-json 1E3))
|
||||
(test "\"\\u00E1\"" (unparse-json "á"))
|
||||
(test "\"\\uD801\\uDC37\"" (unparse-json "𐐷"))
|
||||
(test "\"\\uD83D\\uDE10\"" (unparse-json "😐"))
|
||||
(test "{\"menu\":{\"id\":\"file\",\"value\":\"File\",\"popup\":{\"menuitem\":[{\"value\":\"New\",\"onclick\":\"CreateNewDoc()\"},{\"value\":\"Open\",\"onclick\":\"OpenDoc()\"},{\"value\":\"Close\",\"onclick\":\"CloseDoc()\"}]}}}"
|
||||
(unparse-json '((menu
|
||||
(id . "file")
|
||||
(value . "File")
|
||||
(popup
|
||||
(menuitem
|
||||
. #(((value . "New") (onclick . "CreateNewDoc()"))
|
||||
((value . "Open") (onclick . "OpenDoc()"))
|
||||
((value . "Close") (onclick . "CloseDoc()")))))))))
|
||||
(test "{\"glossary\":{\"title\":\"example glossary\",\"GlossDiv\":{\"title\":\"S\",\"GlossList\":{\"GlossEntry\":{\"ID\":\"SGML\",\"SortAs\":\"SGML\",\"GlossTerm\":\"Standard Generalized Markup Language\",\"Acronym\":\"SGML\",\"Abbrev\":\"ISO 8879:1986\",\"GlossDef\":{\"para\":\"A meta-markup language, used to create markup languages such as DocBook.\",\"GlossSeeAlso\":[\"GML\",\"XML\"]},\"GlossSee\":\"markup\"}}}}}"
|
||||
(unparse-json '((glossary
|
||||
(title . "example glossary")
|
||||
(GlossDiv
|
||||
(title . "S")
|
||||
(GlossList
|
||||
(GlossEntry
|
||||
(ID . "SGML")
|
||||
(SortAs . "SGML")
|
||||
(GlossTerm . "Standard Generalized Markup Language")
|
||||
(Acronym . "SGML")
|
||||
(Abbrev . "ISO 8879:1986")
|
||||
(GlossDef
|
||||
(para . "A meta-markup language, used to create markup languages such as DocBook.")
|
||||
(GlossSeeAlso . #("GML" "XML")))
|
||||
(GlossSee . "markup"))))))))
|
||||
(test-end))))
|
||||
|
|
Loading…
Add table
Reference in a new issue