Skip to content

Commit d726d4f

Browse files
committed
Oops, broke the indices again.
1 parent 24f1432 commit d726d4f

File tree

1 file changed

+4
-2
lines changed
  • jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie

1 file changed

+4
-2
lines changed

jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/VcrSelfie.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ internal constructor(
4646
mutableListOf<Map.Entry<String, SnapshotValue>>()
4747
fun add(key: String, value: SnapshotValue) {
4848
lock.withLock {
49-
frames?.add(entry(key, value))
50-
?: throw IllegalStateException("This VCR was already closed.")
49+
frames?.apply {
50+
val idx = size + 1
51+
add(entry("$OPEN$idx$CLOSE$key", value))
52+
} ?: throw IllegalStateException("This VCR was already closed.")
5153
}
5254
}
5355
fun closeAndGetSnapshot(): Snapshot =

0 commit comments

Comments
 (0)