Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit775a38b

Browse files
SBOne-Kenobidenis-fokin
authored andcommitted
Fix assertions (#1096)
(cherry picked from commit677c15c)
1 parentd5ae1fc commit775a38b

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

‎utbot-framework-api/src/main/kotlin/org/utbot/framework/UtSettings.kt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ object UtSettings : AbstractSettings(
263263
*/
264264
var treatOverflowAsError:Boolean by getBooleanProperty(false)
265265

266+
/**
267+
* Generate tests that treat assertions as error suits.
268+
*
269+
* True by default.
270+
*/
271+
var treatAssertAsErrorSuit:Boolean by getBooleanProperty(true)
272+
266273
/**
267274
* Instrument all classes before start
268275
*/

‎utbot-framework-test/src/test/kotlin/org/utbot/examples/codegen/JavaAssertTest.kt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import org.utbot.tests.infrastructure.UtValueTestCaseChecker
55
importorg.utbot.tests.infrastructure.isException
66
importorg.utbot.testcheckers.eq
77

8-
classJavaAssertTest :UtValueTestCaseChecker(testClass =JavaAssert::class){
8+
classJavaAssertTest :UtValueTestCaseChecker(
9+
testClass =JavaAssert::class,
10+
testCodeGeneration =false
11+
) {
912
@Test
1013
funtestAssertPositive() {
1114
checkWithException(

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ import org.utbot.summary.SummarySentenceConstants.TAB
144144
importjava.lang.reflect.InvocationTargetException
145145
importjava.security.AccessControlException
146146
importjava.lang.reflect.ParameterizedType
147+
importorg.utbot.framework.UtSettings
147148

148149
privateconstvalDEEP_EQUALS_MAX_DEPTH=5// TODO move it to plugin settings?
149150

@@ -361,6 +362,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
361362
if (exceptionisAccessControlException)returnfalse
362363
// tests with timeout or crash should be processed differently
363364
if (exceptionisTimeoutException|| exceptionisConcreteExecutionFailureException)returnfalse
365+
if (UtSettings.treatAssertAsErrorSuit&& exceptionisAssertionError)returnfalse
364366

365367
val exceptionRequiresAssert= exception!isRuntimeException|| runtimeExceptionTestsBehaviour==PASS
366368
val exceptionIsExplicit= execution.resultisUtExplicitlyThrownException

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp