This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
core/src/test/scala/scala/pickling/pickler/DoublePicklerUnpicklerGeneration.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
} | ||
|
||
} |