summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSteffen Fritzsche <steffen.fritzsche@uni-ulm.de>2011-10-11 18:18:26 +0200
committerSteffen Fritzsche <steffen.fritzsche@uni-ulm.de>2011-10-11 18:18:26 +0200
commit211e72c22cf620c12835738b2a62c50867331fa6 (patch)
tree37256c1038104346afc2456a069ecb7de2047925 /src/test
parent2e7e3e955a56ccb5fa9382a42f61de29a31709cd (diff)
downloadspray-json-211e72c22cf620c12835738b2a62c50867331fa6.tar.gz
spray-json-211e72c22cf620c12835738b2a62c50867331fa6.tar.bz2
spray-json-211e72c22cf620c12835738b2a62c50867331fa6.zip
Implemented #8: Conversion of Double.NaN and Infinity to JsNull
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/cc/spray/json/BasicFormatsSpec.scala20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/test/scala/cc/spray/json/BasicFormatsSpec.scala b/src/test/scala/cc/spray/json/BasicFormatsSpec.scala
index fcae4bb..7f74e37 100644
--- a/src/test/scala/cc/spray/json/BasicFormatsSpec.scala
+++ b/src/test/scala/cc/spray/json/BasicFormatsSpec.scala
@@ -26,6 +26,15 @@ class BasicFormatsSpec extends Specification with DefaultJsonProtocol {
"convert a Float to a JsNumber" in {
4.2f.toJson mustEqual JsNumber(4.2f)
}
+ "convert a Float.NaN to a JsNull" in {
+ Float.NaN.toJson mustEqual JsNull
+ }
+ "convert a Float.PositiveInfinity to a JsNull" in {
+ Float.PositiveInfinity.toJson mustEqual JsNull
+ }
+ "convert a Float.NegativeInfinity to a JsNull" in {
+ Float.NegativeInfinity.toJson mustEqual JsNull
+ }
"convert a JsNumber to a Float" in {
JsNumber(4.2f).fromJson[Float] mustEqual 4.2f
}
@@ -35,6 +44,15 @@ class BasicFormatsSpec extends Specification with DefaultJsonProtocol {
"convert a Double to a JsNumber" in {
4.2.toJson mustEqual JsNumber(4.2)
}
+ "convert a Double.NaN to a JsNull" in {
+ Double.NaN.toJson mustEqual JsNull
+ }
+ "convert a Double.PositiveInfinity to a JsNull" in {
+ Double.PositiveInfinity.toJson mustEqual JsNull
+ }
+ "convert a Double.NegativeInfinity to a JsNull" in {
+ Double.NegativeInfinity.toJson mustEqual JsNull
+ }
"convert a JsNumber to a Double" in {
JsNumber(4.2).fromJson[Double] mustEqual 4.2
}
@@ -119,4 +137,4 @@ class BasicFormatsSpec extends Specification with DefaultJsonProtocol {
}
}
-} \ No newline at end of file
+}