Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Commit

Permalink
Add tests that show #409
Browse files Browse the repository at this point in the history
  • Loading branch information
jvican committed Apr 13, 2016
1 parent 479c046 commit 6082667
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package scala.pickling.pickler

import org.scalatest.FunSuite
import scala.pickling._, Defaults._, static._, json._

class DoublePicklerUnpicklerGeneration extends FunSuite {

case class Foo[T](value: T)

import scala.pickling.internal.currentRuntime

test("generation of pickler should return an already generated pickler") {

// This should get the already generated pickler
// which is already stored in the mapPickler
val pickler = implicitly[Pickler[Foo[List[String]]]]
val key = pickler.tag.key
val alreadyGenPickler = currentRuntime.picklers.lookupPickler(key)

assert(alreadyGenPickler.get === pickler)

}

test("generation of unpickler should return an already generated unpickler") {

val unpickler = implicitly[Unpickler[Foo[List[String]]]]
val key = unpickler.tag.key
val alreadyGenUnpickler = currentRuntime.picklers.lookupUnpickler(key)

assert(alreadyGenUnpickler.get === unpickler)

}

}

0 comments on commit 6082667

Please sign in to comment.