diff options
author | Johannes Rudolph <johannes.rudolph@gmail.com> | 2013-08-16 11:18:46 +0200 |
---|---|---|
committer | Johannes Rudolph <johannes.rudolph@gmail.com> | 2013-08-16 11:18:46 +0200 |
commit | 83237b4a640897a22e0800ee6609c1d309292a3b (patch) | |
tree | 062b885c20ca31d3ef9264e2400fb93d6e77b9e6 /src/test | |
parent | e35d195b46a006f57121caaaabda1435f0cd4ef8 (diff) | |
parent | 3cd8cdc93aa1ad69703cafb0af8b801f1c93ecce (diff) | |
download | spray-json-83237b4a640897a22e0800ee6609c1d309292a3b.tar.gz spray-json-83237b4a640897a22e0800ee6609c1d309292a3b.tar.bz2 spray-json-83237b4a640897a22e0800ee6609c1d309292a3b.zip |
Merge commit 'pull/67'
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/scala/spray/json/StandardFormatsSpec.scala | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/test/scala/spray/json/StandardFormatsSpec.scala b/src/test/scala/spray/json/StandardFormatsSpec.scala index 0b4dc26..89f01ac 100644 --- a/src/test/scala/spray/json/StandardFormatsSpec.scala +++ b/src/test/scala/spray/json/StandardFormatsSpec.scala @@ -72,5 +72,50 @@ class StandardFormatsSpec extends Specification with DefaultJsonProtocol { json.convertTo[(Int, Double)] mustEqual (42, 4.2) } } - -}
\ No newline at end of file + + "The tuple3Format" should { + val json = JsArray(JsNumber(42), JsNumber(4.2), JsNumber(3)) + "convert (42, 4.2, 3) to a JsArray" in { + (42, 4.2, 3).toJson mustEqual json + } + "be able to convert a JsArray to a (Int, Double, Int)]" in { + json.convertTo[(Int, Double, Int)] mustEqual (42, 4.2, 3) + } + } + "The tuple4Format" should { + val json = JsArray(JsNumber(42), JsNumber(4.2), JsNumber(3), JsNumber(4)) + "convert (42, 4.2, 3, 4) to a JsArray" in { + (42, 4.2, 3, 4).toJson mustEqual json + } + "be able to convert a JsArray to a (Int, Double, Int, Int)]" in { + json.convertTo[(Int, Double, Int, Int)] mustEqual (42, 4.2, 3, 4) + } + } + "The tuple5Format" should { + val json = JsArray(JsNumber(42), JsNumber(4.2), JsNumber(3), JsNumber(4), JsNumber(5)) + "convert (42, 4.2, 3, 4, 5) to a JsArray" in { + (42, 4.2, 3, 4, 5).toJson mustEqual json + } + "be able to convert a JsArray to a (Int, Double, Int, Int, Int)]" in { + json.convertTo[(Int, Double, Int, Int, Int)] mustEqual (42, 4.2, 3, 4, 5) + } + } + "The tuple6Format" should { + val json = JsArray(JsNumber(42), JsNumber(4.2), JsNumber(3), JsNumber(4), JsNumber(5), JsNumber(6)) + "convert (42, 4.2, 3, 4, 5, 6) to a JsArray" in { + (42, 4.2, 3, 4, 5, 6).toJson mustEqual json + } + "be able to convert a JsArray to a (Int, Double, Int, Int, Int, Int)]" in { + json.convertTo[(Int, Double, Int, Int, Int, Int)] mustEqual (42, 4.2, 3, 4, 5, 6) + } + } + "The tuple7Format" should { + val json = JsArray(JsNumber(42), JsNumber(4.2), JsNumber(3), JsNumber(4), JsNumber(5), JsNumber(6), JsNumber(7)) + "convert (42, 4.2, 3, 4, 5, 6, 7) to a JsArray" in { + (42, 4.2, 3, 4, 5, 6, 7).toJson mustEqual json + } + "be able to convert a JsArray to a (Int, Double, Int, Int, Int, Int, Int)]" in { + json.convertTo[(Int, Double, Int, Int, Int, Int, Int)] mustEqual (42, 4.2, 3, 4, 5, 6, 7) + } + } +} |