Skip to content
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

We can ship 1.0 without multiline for Groovy and Scala #107

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,20 @@ internal object LiteralString : LiteralFormat<String>() {
when (language) {
Language.SCALA, // scala only does $ substitution for s" and f" strings
Language.JAVA_PRE15,
Language.JAVA -> encodeSingleJava(value)
Language.GROOVY,
Language.JAVA -> encodeSingleJava(value)
Language.KOTLIN -> encodeSingleJavaWithDollars(value)
}
else
when (language) {
// TODO: support triple-quoted strings in scala
// https://github.com/diffplug/selfie/issues/106
Language.SCALA,
// TODO: support triple-quoted strings in groovy
// https://github.com/diffplug/selfie/issues/105
Language.GROOVY,
Language.JAVA_PRE15 -> encodeSingleJava(value)
Language.JAVA -> encodeMultiJava(value)
Language.GROOVY,
Language.KOTLIN -> encodeMultiKotlin(value)
}
override fun parse(str: String, language: Language): String =
Expand All @@ -133,10 +137,12 @@ internal object LiteralString : LiteralFormat<String>() {
when (language) {
Language.SCALA ->
throw UnsupportedOperationException(
"Selfie doesn't support triple-quoted strings in Scala")
"Selfie doesn't support triple-quoted strings in Scala, yet - help wanted: https://github.com/diffplug/selfie/issues/106")
Language.GROOVY ->
throw UnsupportedOperationException(
"Selfie doesn't support triple-quoted strings in Groovy, yet - help wanted: https://github.com/diffplug/selfie/issues/105")
Language.JAVA_PRE15,
Language.JAVA -> parseMultiJava(str)
Language.GROOVY,
Language.KOTLIN -> parseMultiKotlin(str)
}
fun encodeSingleJava(value: String): String = encodeSingleJavaish(value, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import kotlin.test.Test

class UT_InlineIntTest {
@Test fun singleInt() {
expectSelfie(7777).toBe(7_777)
expectSelfie(555).toBe_TODO(789)
}
}