From 25fb02b13b721004269f9bd9a4e5d22c2bb219c4 Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Wed, 1 Nov 2017 11:36:14 +0100 Subject: Support for GADTs (including recursive ones) Some tests still failing, but macros are working --- tests/src/main/scala/tests.scala | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/src/main/scala/tests.scala b/tests/src/main/scala/tests.scala index ee3faf0..aea6cc3 100644 --- a/tests/src/main/scala/tests.scala +++ b/tests/src/main/scala/tests.scala @@ -23,11 +23,11 @@ object Tests extends TestApp { Show.generic[Person].show(Person("John Smith", 34)) }.assert(_ == "Person(name=John Smith,age=34)") - Show.generic[Tree] + //Show.generic[Tree[String]] test("serialize a Branch") { import magnolia.examples._ - implicitly[Show[String, Branch]].show(Branch(Leaf("LHS"), Leaf("RHS"))) + implicitly[Show[String, Branch[String]]].show(Branch(Leaf("LHS"), Leaf("RHS"))) }.assert(_ == "Branch(left=Leaf(value=LHS),right=Leaf(value=RHS))") test("test equality false") { @@ -42,7 +42,7 @@ object Tests extends TestApp { test("test branch equality true") { import examples._ - Eq.generic[Tree].equal(Branch(Leaf("one"), Leaf("two")), Branch(Leaf("one"), Leaf("two"))) + Eq.generic[Tree[String]].equal(Branch(Leaf("one"), Leaf("two")), Branch(Leaf("one"), Leaf("two"))) }.assert(_ == true) test("construct a default value") { @@ -52,23 +52,23 @@ object Tests extends TestApp { test("construction of Show instance for Leaf") { scalac""" import magnolia.examples._ - implicitly[Show[String, Leaf]] + implicitly[Show[String, Leaf[String]]] """ - }.assert(_ == (Returns(fqt"magnolia.examples.Show[String,magnolia.examples.Leaf]"): Compilation)) + }.assert(_ == (Returns(fqt"magnolia.examples.Show[String,magnolia.examples.Leaf[java.lang.String]]"): Compilation)) test("construction of Show instance for Tree") { scalac""" import magnolia.examples._ - implicitly[Show[String, Tree]] + implicitly[Show[String, Tree[String]]] """ - }.assert(_ == (Returns(fqt"magnolia.examples.Show[String,magnolia.examples.Tree]"): Compilation)) + }.assert(_ == (Returns(fqt"magnolia.examples.Show[String,magnolia.examples.Tree[String]]"): Compilation)) test("serialize a Leaf") { - implicitly[Show[String, Leaf]].show(Leaf("testing")) + implicitly[Show[String, Leaf[String]]].show(Leaf("testing")) }.assert(_ == "Leaf(value=testing)") test("serialize a Branch as a Tree") { - implicitly[Show[String, Tree]].show(Branch(Leaf("LHS"), Leaf("RHS"))) + implicitly[Show[String, Tree[String]]].show(Branch(Leaf("LHS"), Leaf("RHS"))) }.assert(_ == "Branch(left=Leaf(value=LHS),right=Leaf(value=RHS))") test("show error stack") { @@ -84,8 +84,8 @@ object Tests extends TestApp { |"""): Compilation)) //test("construct a decoder") { - //Decoder.generic[Tree].decode("string") - //}.assert(_ == (Leaf("something"): Tree)) + //Decoder.generic[Tree[String]].decode("string") + //}.assert(_ == (Leaf("something"): Tree[String])) } } -- cgit v1.2.3