diff options
author | Konrad Malawski <konrad.malawski@project13.pl> | 2016-04-22 15:13:48 +0200 |
---|---|---|
committer | Konrad Malawski <konrad.malawski@project13.pl> | 2016-04-22 15:13:48 +0200 |
commit | aae2c6ef9e33e204aa4040689465804150ec226b (patch) | |
tree | 15eb41471d523aad67f6daf07827845214af866d /src/test/scala | |
parent | 4fbde3a833cb122c71aaf85a1b3bbd31e130cb62 (diff) | |
download | spray-json-aae2c6ef9e33e204aa4040689465804150ec226b.tar.gz spray-json-aae2c6ef9e33e204aa4040689465804150ec226b.tar.bz2 spray-json-aae2c6ef9e33e204aa4040689465804150ec226b.zip |
+#182 allows BigInt/BigDecimal to be obtained from JsStrings
Diffstat (limited to 'src/test/scala')
-rw-r--r-- | src/test/scala/spray/json/BasicFormatsSpec.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/scala/spray/json/BasicFormatsSpec.scala b/src/test/scala/spray/json/BasicFormatsSpec.scala index 629c223..00da813 100644 --- a/src/test/scala/spray/json/BasicFormatsSpec.scala +++ b/src/test/scala/spray/json/BasicFormatsSpec.scala @@ -105,6 +105,9 @@ class BasicFormatsSpec extends Specification with DefaultJsonProtocol { "convert a JsNumber to a BigDecimal" in { JsNumber(42).convertTo[BigDecimal] mustEqual BigDecimal(42) } + """convert a JsString to a BigDecimal (to allow the quoted-large-numbers pattern)""" in { + JsString("9223372036854775809").convertTo[BigDecimal] mustEqual BigDecimal("9223372036854775809") + } } "The BigIntJsonFormat" should { @@ -114,6 +117,9 @@ class BasicFormatsSpec extends Specification with DefaultJsonProtocol { "convert a JsNumber to a BigInt" in { JsNumber(42).convertTo[BigInt] mustEqual BigInt(42) } + """convert a JsString to a BigInt (to allow the quoted-large-numbers pattern)""" in { + JsString("9223372036854775809").convertTo[BigInt] mustEqual BigInt("9223372036854775809") + } } "The UnitJsonFormat" should { |