diff options
author | Pasi Eronen <pe@iki.fi> | 2015-11-02 16:29:55 +0200 |
---|---|---|
committer | Pasi Eronen <pe@iki.fi> | 2015-11-02 16:29:55 +0200 |
commit | 6db24d692854339c41b483cc24c0b42cff255736 (patch) | |
tree | c8a02a3dc44a0bc07ba0b8bb662f9698727a5a32 /src/test/scala | |
parent | 0acc06900b3d0cc0720357cf72971033ca5b641a (diff) | |
download | spray-json-6db24d692854339c41b483cc24c0b42cff255736.tar.gz spray-json-6db24d692854339c41b483cc24c0b42cff255736.tar.bz2 spray-json-6db24d692854339c41b483cc24c0b42cff255736.zip |
Rename JsonParser parameter requireEndOfInput to allowTrailingInput, add test case
Diffstat (limited to 'src/test/scala')
-rw-r--r-- | src/test/scala/spray/json/JsonParserSpec.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/test/scala/spray/json/JsonParserSpec.scala b/src/test/scala/spray/json/JsonParserSpec.scala index e6a6899..4141007 100644 --- a/src/test/scala/spray/json/JsonParserSpec.scala +++ b/src/test/scala/spray/json/JsonParserSpec.scala @@ -108,10 +108,17 @@ class JsonParserSpec extends Specification { |""".stripMargin } - "parse multiple values when requireEndOfInput is false" in { + "parse multiple values when allowTrailingInput" in { val parser = new JsonParser("""{"key":1}{"key":2}""") - parser.parseJsValue(false) === JsObject("key" -> JsNumber(1)) - parser.parseJsValue(false) === JsObject("key" -> JsNumber(2)) + parser.parseJsValue(true) === JsObject("key" -> JsNumber(1)) + parser.parseJsValue(true) === JsObject("key" -> JsNumber(2)) } + "reject trailing input when !allowTrailingInput" in { + def parser = JsonParser("""{"key":1}x""") + parser must throwA[JsonParser.ParsingException].like { + case e: JsonParser.ParsingException => e.getMessage must contain("expected end-of-input") + } + } + } }
\ No newline at end of file |