Skip to content

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

Conversation

volivan239
Copy link
Collaborator

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.

  • Minor bug fix (non-breaking small changes)
  • Bug fix (non-breaking change which fixes an issue)
  • Refactoring (typos and non-functional changes)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

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

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • New tests have been added
  • All tests pass locally with my changes

@volivan239 volivan239 changed the base branch from volivan239/improve_test_naming_for_nested_classes to main August 5, 2022 16:35
@volivan239 volivan239 changed the base branch from main to volivan239/improve_test_naming_for_nested_classes August 5, 2022 19:30
@volivan239 volivan239 changed the title Method constructor refactoring CgMethodConstructor refactoring Aug 5, 2022
@volivan239 volivan239 force-pushed the volivan239/method_constructor_refactoring branch from 537821d to 424f4c3 Compare August 8, 2022 14:46
@volivan239 volivan239 requested a review from ArsenHD August 8, 2022 15:03
@@ -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")
Copy link
Collaborator

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?
Copy link
Collaborator

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>()
Copy link
Collaborator

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))
Copy link
Collaborator

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.

@volivan239
Copy link
Collaborator Author

Thanks for review! Fixed, changes from this PR will be cherry-picked in #665

@volivan239 volivan239 closed this Aug 10, 2022
@volivan239 volivan239 deleted the volivan239/method_constructor_refactoring branch August 25, 2022 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants