aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJon Pretty <jon.pretty@propensive.com>2017-10-30 19:25:07 +0100
committerJon Pretty <jon.pretty@propensive.com>2017-10-30 19:25:07 +0100
commit7b776425828d27b3112ad5bddafaa7564c326536 (patch)
treebe041b460d9fced354fa6a7dabd03d7ced185d5a /tests
parent86c66ba93b5dc15301ac305fa28e24952e232613 (diff)
downloadmagnolia-7b776425828d27b3112ad5bddafaa7564c326536.tar.gz
magnolia-7b776425828d27b3112ad5bddafaa7564c326536.tar.bz2
magnolia-7b776425828d27b3112ad5bddafaa7564c326536.zip
Support for case objects
Diffstat (limited to 'tests')
-rw-r--r--tests/src/main/scala/tests.scala (renamed from tests/src/main/scala/main.scala)23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/src/main/scala/main.scala b/tests/src/main/scala/tests.scala
index 99ffe56..6bfa1bd 100644
--- a/tests/src/main/scala/main.scala
+++ b/tests/src/main/scala/tests.scala
@@ -16,18 +16,20 @@ object Tests extends TestApp {
test("construct a Show product instance") {
import examples._
Show.generic[Person].show(Person("John Smith", 34))
- }.assert(_ == """{name=John Smith,age=34}""")
+ }.assert(_ == """Person(name=John Smith,age=34)""")
test("construct a Show coproduct instance") {
import examples._
Show.generic[Person].show(Person("John Smith", 34))
- }.assert(_ == "{name=John Smith,age=34}")
+ }.assert(_ == "Person(name=John Smith,age=34)")
+ Show.generic[Tree]
+
test("serialize a Branch") {
import magnolia.examples._
implicitly[Show[Branch]].show(Branch(Leaf("LHS"), Leaf("RHS")))
- }.assert(_ == "{left={value=LHS},right={value=RHS}}")
-
+ }.assert(_ == "Branch(left=Leaf(value=LHS),right=Leaf(value=RHS))")
+
test("test equality false") {
import examples._
Eq.generic[Entity].equal(Person("John Smith", 34), Person("", 0))
@@ -63,15 +65,11 @@ object Tests extends TestApp {
test("serialize a Leaf") {
implicitly[Show[Leaf]].show(Leaf("testing"))
- }.assert(_ == "{value=testing}")
+ }.assert(_ == "Leaf(value=testing)")
test("serialize a Branch as a Tree") {
implicitly[Show[Tree]].show(Branch(Leaf("LHS"), Leaf("RHS")))
- }.assert(_ == "{left={value=LHS},right={value=RHS}}")
-
- /*test("construct a decoder") {
- Decoder.generic[Tree].decode("string")
- }.assert(_ == (Leaf("something"): Tree))*/
+ }.assert(_ == "Branch(left=Leaf(value=LHS),right=Leaf(value=RHS))")
test("show error stack") {
scalac"""
@@ -84,5 +82,10 @@ object Tests extends TestApp {
| in parameter 'integer' of product type Alpha
| in parameter 'alpha' of product type Beta
|"""): Compilation))
+
+ //test("construct a decoder") {
+ //Decoder.generic[Tree].decode("string")
+ //}.assert(_ == (Leaf("something"): Tree))
+
}
}