Skip to content

Add string interpolation support in codegen #1587

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

Merged
merged 1 commit into from
Dec 27, 2022

Conversation

sofurihafe
Copy link
Member

@sofurihafe sofurihafe commented Dec 26, 2022

Description

This PR adds string interpolation support for Java and Kotlin codegen.

Fixes # (1546)

Type of Change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Regression and integration tests

Automated Testing

utbot-samples.

Manual Scenario

Usage example:

CgFormattedString(
    listOf(
        stringLiteral("Custom message:"),
        actual,
        stringLiteral("has to be"),
        expected
    )
)

It will produce the following results:
For Java:

String.format("Custom message: %s has to be 1", actual)

For Kotlin:

"Custom message: $actual has to be 1"

@sofurihafe sofurihafe force-pushed the andrey-t/interpolated_string_support branch from 58f289e to f8d3fa7 Compare December 26, 2022 09:49
@sofurihafe sofurihafe linked an issue Dec 26, 2022 that may be closed by this pull request
@sofurihafe sofurihafe force-pushed the andrey-t/interpolated_string_support branch 2 times, most recently from c3b4e12 to 294b747 Compare December 26, 2022 13:07
@sofurihafe sofurihafe force-pushed the andrey-t/interpolated_string_support branch from 294b747 to 33dc1e8 Compare December 27, 2022 05:53
@EgorkaKulikov EgorkaKulikov merged commit 9bb4e7a into main Dec 27, 2022
@EgorkaKulikov EgorkaKulikov deleted the andrey-t/interpolated_string_support branch December 27, 2022 09:22
@alisevych alisevych added ctg-enhancement New feature, improvement or change request comp-codegen Issue is related to code generator labels Jan 23, 2023
@alisevych alisevych added this to the 2023.03 Release milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-codegen Issue is related to code generator ctg-enhancement New feature, improvement or change request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support string interpolation in code generator
3 participants