Skip to content

Commit 2aa66be

Browse files
committed
SI-4664 [Make scala.util.Random Serializable] Add test case
1 parent 0b92073 commit 2aa66be

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/files/jvm/serialization.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ object Test {
604604
Test7
605605
Test8
606606
Test9_parallel
607+
Test10_util
607608
}
608609
}
609610

@@ -669,3 +670,17 @@ object Test9_parallel {
669670
throw e
670671
}
671672
}
673+
674+
//############################################################################
675+
// Test classes in package scala.util
676+
677+
object Test10_util {
678+
import scala.util.Random
679+
def rep[A](n: Int)(f: => A) { if (n > 0) { f; rep(n-1)(f) } }
680+
681+
try {
682+
val random = new Random(345)
683+
val random2: Random = read(write(random))
684+
rep(5) { assert(random.nextInt == random2.nextInt) }
685+
}
686+
}

0 commit comments

Comments
 (0)