@@ -32,25 +32,6 @@ import kotlin.io.encoding.ExperimentalEncodingApi
3232import kotlin.jvm.JvmOverloads
3333import kotlin.jvm.JvmStatic
3434
35- /* *
36- * Used for creating snapshots which are independent of the thread or coroutine on which the test
37- * started. See the [threading details](http://localhost:3000/jvm/kotest#threading-details) for more
38- * info.
39- */
40- class SelfieBound internal constructor(private val disk : DiskStorage ) {
41- fun <T > expectSelfie (actual : T , camera : Camera <T >) = expectSelfie(camera.snapshot(actual))
42- fun expectSelfie (actual : String ) = expectSelfie(Snapshot .of(actual))
43- fun expectSelfie (actual : ByteArray ) = expectSelfie(Snapshot .of(actual))
44- fun expectSelfie (actual : Snapshot ) = Selfie .DiskSelfie (actual, disk)
45- fun preserveSelfiesOnDisk (vararg subsToKeep : String ) {
46- if (subsToKeep.isEmpty()) {
47- disk.keep(null )
48- } else {
49- subsToKeep.forEach { disk.keep(it) }
50- }
51- }
52- }
53-
5435/* * Static methods for creating snapshots. */
5536object Selfie {
5637 internal val system: SnapshotSystem = initSnapshotSystem()
@@ -69,15 +50,14 @@ object Selfie {
6950 */
7051 @JvmStatic
7152 fun preserveSelfiesOnDisk (vararg subsToKeep : String ) {
72- bind().preserveSelfiesOnDisk(* subsToKeep)
53+ val disk = system.diskThreadLocal()
54+ if (subsToKeep.isEmpty()) {
55+ disk.keep(null )
56+ } else {
57+ subsToKeep.forEach { disk.keep(it) }
58+ }
7359 }
7460
75- /* *
76- * Used to bind to the currently executing test so that you can create disk selfies in other
77- * threads and coroutines if you want.
78- */
79- @JvmStatic fun bind () = SelfieBound (system.diskThreadLocal())
80-
8161 class DiskSelfie internal constructor(actual : Snapshot , val disk : DiskStorage ) :
8262 LiteralStringSelfie (actual) {
8363 @JvmOverloads
0 commit comments