test suite test json printer
import idealmachinecharactersunicode handler
private json printer make printer()
return json printer • new(unicode handlerinstance)
test case test basic printer()
json0 : printerprint("'Hello, world!'\n\\")
assert json0 == "\"'Hello, world!'\\n\\\\\""
json1 : printerprint(68)
assert json1 == "68"
json2 : printerprint([42, 68])
assert json2 == "[42, 68]"
json3 : printerprint(missinginstance)
assert json3 == "null"
the dictionary : list dictionary[string, readonly value] • new()
the dictionaryput("foo", "bar")
the dictionaryput("baz", 68)
json4 : printerprint(the dictionary)
assert json4 == "{\"foo\": \"bar\", \"baz\": 68}"
the dictionary2 : list dictionary[string, readonly value] • new()
the dictionary2put("foo", false)
the dictionary2put("bar", true)
json5 : printerprint(the dictionary2)
assert json5 == "{\"foo\": false, \"bar\": true}"