diff options
author | Mathias <mathias@spray.cc> | 2011-05-06 11:11:37 +0200 |
---|---|---|
committer | Mathias <mathias@spray.cc> | 2011-05-06 11:11:37 +0200 |
commit | 0ce9cf8fce1dc475f3bb2a517e0a7698c9e0a5d9 (patch) | |
tree | 62de608642a30ec478411d27e94179ec64c5bd17 /src/test/scala/cc/spray/json/PrettyPrinterSpec.scala | |
download | spray-json-0ce9cf8fce1dc475f3bb2a517e0a7698c9e0a5d9.tar.gz spray-json-0ce9cf8fce1dc475f3bb2a517e0a7698c9e0a5d9.tar.bz2 spray-json-0ce9cf8fce1dc475f3bb2a517e0a7698c9e0a5d9.zip |
Initial commit (split off from main spray codebase)
Diffstat (limited to 'src/test/scala/cc/spray/json/PrettyPrinterSpec.scala')
-rw-r--r-- | src/test/scala/cc/spray/json/PrettyPrinterSpec.scala | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/scala/cc/spray/json/PrettyPrinterSpec.scala b/src/test/scala/cc/spray/json/PrettyPrinterSpec.scala new file mode 100644 index 0000000..541abc9 --- /dev/null +++ b/src/test/scala/cc/spray/json/PrettyPrinterSpec.scala @@ -0,0 +1,50 @@ +package cc.spray.json + +import org.specs.Specification + +class PrettyPrinterSpec extends Specification { + + "The PrettyPrinter" should { + "print a more complicated JsObject nicely aligned" in { + PrettyPrinter { + JsonParser { + """|{ + | "simpleKey" : "some value", + | "key with spaces": null, + | "zero": 0, + | "number": -1.2323424E-5, + | "Boolean yes":true, + | "Boolean no": false, + | "Unic\u00f8de" : "Long string with newline\nescape", + | "key with \"quotes\"" : "string", + | "sub object" : { + | "sub key": 26.5, + | "a": "b", + | "array": [1, 2, { "yes":1, "no":0 }, ["a", "b", null], false] + | } + |}""".stripMargin + } + } mustEqual { + """|{ + | "simpleKey": "some value", + | "key with spaces": null, + | "zero": 0, + | "number": -0.000012323424, + | "Boolean yes": true, + | "Boolean no": false, + | "Unic\u00f8de": "Long string with newline\nescape", + | "key with \"quotes\"": "string", + | "sub object": { + | "sub key": 26.5, + | "a": "b", + | "array": [1, 2, { + | "yes": 1, + | "no": 0 + | }, ["a", "b", null], false] + | } + |}""".stripMargin.replace("\u00f8", "\\u00f8") + } + } + } + +}
\ No newline at end of file |