@@ -70,33 +70,21 @@ class VcrSelfie(
70
70
disk.writeDisk(snapshot, sub, call)
71
71
}
72
72
}
73
- fun <K , V > next (
74
- roundtripKey : Roundtrip <K , String >,
75
- key : K ,
76
- roundtripValue : Roundtrip <V , String >,
77
- value : Cacheable <V >
78
- ): V {
73
+ fun <V > next (key : String , roundtripValue : Roundtrip <V , String >, value : Cacheable <V >): V {
79
74
if (state.readMode) {
80
75
val expected = state.sequence[state.count++ ]
81
- val keyString = roundtripKey.serialize(key)
82
- if (expected.first != keyString) {
76
+ if (expected.first != key) {
83
77
throw Selfie .system.fs.assertFailed(
84
- " vcr key mismatch at index ${state.count - 1 } " , expected, keyString )
78
+ " vcr key mismatch at index ${state.count - 1 } " , expected.first, key )
85
79
}
86
80
return roundtripValue.parse(expected.second.valueString())
87
81
} else {
88
82
val value = value.get()
89
- state.sequence.add(
90
- roundtripKey.serialize(key) to SnapshotValue .of(roundtripValue.serialize(value)))
83
+ state.sequence.add(key to SnapshotValue .of(roundtripValue.serialize(value)))
91
84
return value
92
85
}
93
86
}
94
- fun next (key : String , value : Cacheable <String >): String =
95
- next(Roundtrip .identity(), key, Roundtrip .identity(), value)
96
- fun <K > next (roundtripKey : Roundtrip <K , String >, key : K , value : Cacheable <String >): String =
97
- next(roundtripKey, key, Roundtrip .identity(), value)
98
- fun <V > next (key : String , roundtripValue : Roundtrip <V , String >, value : Cacheable <V >): V =
99
- next(Roundtrip .identity(), key, roundtripValue, value)
100
- inline fun <reified K , reified V > nextJson (key : K , value : Cacheable <V >): V =
101
- next(RoundtripJson .of<K >(), key, RoundtripJson .of<V >(), value)
87
+ fun next (key : String , value : Cacheable <String >): String = next(key, Roundtrip .identity(), value)
88
+ inline fun <reified V > nextJson (key : String , value : Cacheable <V >): V =
89
+ next(key, RoundtripJson .of<V >(), value)
102
90
}
0 commit comments