1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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")
}
}
}
}
|