@@ -231,8 +231,10 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
231
231
val fieldAccessible = field.isAccessibleFrom(testClassPackageName)
232
232
233
233
// prevValue is nullable if not accessible because of getStaticFieldValue(..) : Any?
234
- val prevValue = newVar(CgClassId (field.type, isNullable = ! fieldAccessible),
235
- " prev${field.name.capitalize()} " ) {
234
+ val prevValue = newVar(
235
+ CgClassId (field.type, isNullable = ! fieldAccessible),
236
+ " prev${field.name.capitalize()} "
237
+ ) {
236
238
if (fieldAccessible) {
237
239
declaringClass[field]
238
240
} else {
@@ -1198,7 +1200,8 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1198
1200
it.variableName,
1199
1201
// guard initializer to reuse typecast creation logic
1200
1202
initializer = guardExpression(varType, nullLiteral()).expression,
1201
- isMutable = true )
1203
+ isMutable = true ,
1204
+ )
1202
1205
}
1203
1206
+ tryWithMocksFinallyClosing
1204
1207
}
@@ -1253,10 +1256,13 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1253
1256
}
1254
1257
val method = currentExecutable as MethodId
1255
1258
val containsFailureExecution = containsFailureExecution(testSet)
1256
- if (method.returnType != voidClassId) {
1259
+
1260
+ val expectedResultClassId = wrapTypeIfRequired(method.returnType)
1261
+
1262
+ if (expectedResultClassId != voidClassId) {
1257
1263
testArguments + = CgParameterDeclaration (
1258
- expectedResultVarName, resultClassId(method.returnType ),
1259
- isReferenceType = containsFailureExecution || ! method.returnType .isPrimitive
1264
+ expectedResultVarName, resultClassId(expectedResultClassId ),
1265
+ isReferenceType = containsFailureExecution || ! expectedResultClassId .isPrimitive
1260
1266
)
1261
1267
}
1262
1268
if (containsFailureExecution) {
0 commit comments