-
Notifications
You must be signed in to change notification settings - Fork 46
CgMethodConstructor refactoring #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CgMethodConstructor refactoring #677
Conversation
537821d
to
424f4c3
Compare
@@ -1317,7 +1310,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c | |||
return withDataProviderScope { | |||
dataProviderMethod(dataProviderMethodName) { | |||
val argListLength = testSet.executions.size | |||
val argListVariable = createArgList(argListLength) | |||
val argListVariable = testFrameworkManager.createArgList(argListLength, "argList") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not pass "argList" as an argument. Just use "argList" inside of createArgList()
method like it was done before.
@@ -221,6 +262,25 @@ internal fun CgContextOwner.typeCast( | |||
return CgTypeCast(targetType, expression, isSafetyCast) | |||
} | |||
|
|||
// TODO: Doesn't it work for any array? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does
@@ -408,6 +480,28 @@ internal class Junit5Manager(context: CgContext) : TestFrameworkManager(context) | |||
+assertions[assertThrows](exception.toExceptionClass(), lambda) | |||
} | |||
|
|||
override fun createDataProviderAnnotations(dataProviderMethodName: String?) = mutableListOf<CgAnnotation>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: add a blank line after this method
mutableListOf( | ||
statementConstructor.annotation( | ||
testFramework.methodSourceAnnotationId, | ||
listOf("name" to CgLiteral(stringClassId, dataProviderMethodName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of CgLiteral(stringClassId, dataProviderMethodName
you can write stringLiteral(dataProviderMethodName)
.
stringLiteral()
is a function made to write such code more briefly. There are also booleanLiteral()
, intLiteral()
, etc.
Thanks for review! Fixed, changes from this PR will be cherry-picked in #665 |
Description
Substitute this text with a concise description of the proposed change. Emphasize, why particular solution was chosen.
Fixes # (issue)
Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Automated Testing
Specify tests that help to verify the change automatically.
Example: org.utbot.examples.algorithms.BinarySearchTest
Manual Scenario
Please, provide several scenarios that you went through to verify that the change worked as expected.
Checklist (remove irrelevant options):
This is the author self-check list