diff options
author | Johannes Rudolph <johannes.rudolph@gmail.com> | 2014-03-12 13:12:25 +0100 |
---|---|---|
committer | Johannes Rudolph <johannes.rudolph@gmail.com> | 2014-03-12 13:12:25 +0100 |
commit | 3180cfafbaa91ada879a3bd7e1be6f3064c14cc5 (patch) | |
tree | 9ad6a29edae9531254df9bdb27b1926a604708b5 /src/test/scala | |
parent | 615f60aa6e8e9481ada227bc0a6db76ba8c34920 (diff) | |
download | spray-json-3180cfafbaa91ada879a3bd7e1be6f3064c14cc5.tar.gz spray-json-3180cfafbaa91ada879a3bd7e1be6f3064c14cc5.tar.bz2 spray-json-3180cfafbaa91ada879a3bd7e1be6f3064c14cc5.zip |
match spec tightly about which characters to encode, fixes #83, #46
Diffstat (limited to 'src/test/scala')
-rw-r--r-- | src/test/scala/spray/json/CompactPrinterSpec.scala | 10 | ||||
-rw-r--r-- | src/test/scala/spray/json/PrettyPrinterSpec.scala | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/test/scala/spray/json/CompactPrinterSpec.scala b/src/test/scala/spray/json/CompactPrinterSpec.scala index 79c0877..6a9560b 100644 --- a/src/test/scala/spray/json/CompactPrinterSpec.scala +++ b/src/test/scala/spray/json/CompactPrinterSpec.scala @@ -49,12 +49,16 @@ class CompactPrinterSpec extends Specification { CompactPrinter(JsString("xyz")) mustEqual "\"xyz\"" } "properly escape special chars in JsString" in { - CompactPrinter(JsString("\"\\\b\f\n\r\t\u12AB")) mustEqual """"\"\\\b\f\n\r\t""" + "\\u12ab\"" - CompactPrinter(JsString("\u1000")) mustEqual "\"\\u1000\"" - CompactPrinter(JsString("\u0100")) mustEqual "\"\\u0100\"" + CompactPrinter(JsString("\"\\\b\f\n\r\t")) mustEqual """"\"\\\b\f\n\r\t"""" + CompactPrinter(JsString("\u1000")) mustEqual "\"\u1000\"" + CompactPrinter(JsString("\u0100")) mustEqual "\"\u0100\"" CompactPrinter(JsString("\u0010")) mustEqual "\"\\u0010\"" CompactPrinter(JsString("\u0001")) mustEqual "\"\\u0001\"" CompactPrinter(JsString("\u001e")) mustEqual "\"\\u001e\"" + // don't escape as it isn't required by the spec + CompactPrinter(JsString("\u007f")) mustEqual "\"\u007f\"" + CompactPrinter(JsString("飞机因此受到损伤")) mustEqual "\"飞机因此受到损伤\"" + CompactPrinter(JsString("\uD834\uDD1E")) mustEqual "\"\uD834\uDD1E\"" } "properly print a simple JsObject" in ( CompactPrinter(JsObject("key" -> JsNumber(42), "key2" -> JsString("value"))) diff --git a/src/test/scala/spray/json/PrettyPrinterSpec.scala b/src/test/scala/spray/json/PrettyPrinterSpec.scala index 8b7bc2b..27137a8 100644 --- a/src/test/scala/spray/json/PrettyPrinterSpec.scala +++ b/src/test/scala/spray/json/PrettyPrinterSpec.scala @@ -58,7 +58,7 @@ class PrettyPrinterSpec extends Specification { | "no": 0 | }, ["a", "b", null], false] | } - |}""".stripMargin.replace("\u00f8", "\\u00f8") + |}""".stripMargin } } } |