Skip to content

Commit fd02764

Browse files
committed
Improve message rendering
1 parent a34e7fc commit fd02764

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,20 +367,13 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte
367367
}
368368
}
369369

370-
//TODO: ISSUE-1546 introduce some kind of language-specific string interpolation in Codegen
371-
private fun prepareArtificialFailureMessage(executionResult: UtExecutionResult): CgVariable {
370+
// TODO: ISSUE-1546 introduce some kind of language-specific string interpolation in Codegen
371+
// and render arguments that cause overflow (but it requires engine enhancements)
372+
private fun prepareArtificialFailureMessage(executionResult: UtExecutionResult): CgLiteral {
372373
when (executionResult) {
373374
is UtOverflowFailure -> {
374-
val preparedMethodArguments = methodArguments.joinToString(separator = ", ") {
375-
when (it) {
376-
is CgVariable -> it.name
377-
is CgLiteral -> it.value.toString()
378-
else -> it.toString()
379-
}
380-
}
381-
382-
val failureMessage = "\"Overflow detected in \'${currentExecutable!!.name}\' call with arguments $preparedMethodArguments \""
383-
return CgVariable(failureMessage, stringClassId)
375+
val failureMessage = "Overflow detected in \'${currentExecutable!!.name}\' call"
376+
return CgLiteral(stringClassId, failureMessage)
384377
}
385378
else -> error("$executionResult is not supported in artificial errors")
386379
}
@@ -433,7 +426,7 @@ open class CgMethodConstructor(val context: CgContext) : CgContextOwner by conte
433426
if (exception is AccessControlException) return false
434427
// tests with timeout or crash should be processed differently
435428
if (exception is TimeoutException || exception is ConcreteExecutionFailureException) return false
436-
if (exception is OverflowDetectionError) return false
429+
if (exception is ArtificialError) return false
437430
if (UtSettings.treatAssertAsErrorSuite && exception is AssertionError) return false
438431

439432
val exceptionRequiresAssert = exception !is RuntimeException || runtimeExceptionTestsBehaviour == PASS

0 commit comments

Comments
 (0)