diff --git a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CliGitClientTest.kt b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CliGitClientTest.kt index a3c7bf1..27ad8d7 100644 --- a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CliGitClientTest.kt +++ b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CliGitClientTest.kt @@ -733,7 +733,7 @@ class CliGitClientTest { This is a commit body - """ + """ .trimIndent(), mapOf("Co-authored-by" to "Michael Sims"), DEFAULT_COMMITTER, diff --git a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CommitParsersTest.kt b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CommitParsersTest.kt index b170a96..f771b5c 100644 --- a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CommitParsersTest.kt +++ b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/CommitParsersTest.kt @@ -30,10 +30,10 @@ class CommitParsersTest { fun `getSubjectAndBodyFromFullMessage - subject and body`() { val message = """ - This is a subject - - This is a body - + This is a subject + + This is a body + """ .trimIndent() @@ -47,12 +47,12 @@ class CommitParsersTest { fun `getSubjectAndBodyFromFullMessage - multiline subject`() { val message = """ - This is a subject - with three lines - but still a subject - - This is a body - + This is a subject + with three lines + but still a subject + + This is a body + """ .trimIndent() @@ -79,9 +79,9 @@ class CommitParsersTest { fun `getFooters - subject and body only`() { val message = """ - This is a subject + This is a subject - This is a body + This is a body """ .trimIndent() @@ -93,12 +93,12 @@ class CommitParsersTest { fun `getFooters - subject, body with footer-like lines`() { val message = """ - This is a subject + This is a subject - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two """ .trimIndent() @@ -110,10 +110,10 @@ class CommitParsersTest { fun `getFooters - subject, body url that could look like a footer line if your code was bad`() { val message = """ - This is a subject + This is a subject - See this Slack thread: - https://trillianthealth.slack.com/archives/C04J6Q655GR/p1702918943374039?thread_ts=1702918322.439999&cid=C04J6Q655GR + See this Slack thread: + https://trillianthealth.slack.com/archives/C04J6Q655GR/p1702918943374039?thread_ts=1702918322.439999&cid=C04J6Q655GR """ .trimIndent() @@ -125,15 +125,15 @@ class CommitParsersTest { fun `getFooters - subject, body, existing footer lines`() { val message = """ - This is a subject + This is a subject + + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two - - key-one: value-three - key-two: value-four + key-one: value-three + key-two: value-four """ .trimIndent() @@ -148,15 +148,15 @@ class CommitParsersTest { fun `getFooters - subject, body, existing footer lines with multiples - last one wins`() { val message = """ - This is a subject + This is a subject + + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two - - key-one: value-three - key-one: value-four + key-one: value-three + key-one: value-four """ .trimIndent() @@ -172,7 +172,7 @@ class CommitParsersTest { Co-authored-by: John Carmack commit-id: I0e9e0b26 - """ + """ .trimIndent() assertEquals( @@ -191,7 +191,7 @@ class CommitParsersTest { This is a commit subject keys with spaces are not allowed: value - """ + """ .trimIndent() assertEquals(emptyMap(), getFooters(message)) @@ -201,9 +201,9 @@ class CommitParsersTest { fun `addFooters - subject only`() { assertEquals( """ - This is a subject - - key1: value1 + This is a subject + + key1: value1 """ .trimIndent(), @@ -215,9 +215,9 @@ class CommitParsersTest { fun `addFooters - subject with newline`() { assertEquals( """ - This is a subject - - key1: value1 + This is a subject + + key1: value1 """ .trimIndent(), @@ -229,9 +229,9 @@ class CommitParsersTest { fun `addFooters - subject and body only`() { val message = """ - This is a subject + This is a subject - This is a body + This is a body """ .trimIndent() @@ -241,7 +241,7 @@ class CommitParsersTest { This is a subject This is a body - + key1: value1 """ @@ -254,12 +254,12 @@ class CommitParsersTest { fun `addFooters - subject, body with footer-like lines`() { val message = """ - This is a subject + This is a subject - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two """ .trimIndent() @@ -272,7 +272,7 @@ class CommitParsersTest { The following are still part of the body: key-one: value-one key-two: value-two - + key1: value1 """ @@ -285,15 +285,15 @@ class CommitParsersTest { fun `addFooters - subject, body, existing footer lines`() { val message = """ - This is a subject + This is a subject - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two - - key-one: value-three - key-two: value-four + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two + + key-one: value-three + key-two: value-four """ .trimIndent() @@ -306,7 +306,7 @@ class CommitParsersTest { The following are still part of the body: key-one: value-one key-two: value-two - + key-one: value-three key-two: value-four key1: value1 @@ -321,15 +321,15 @@ class CommitParsersTest { fun `addFooters - subject, body, existing footer lines with multiples - last one wins`() { val message = """ - This is a subject + This is a subject + + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two - - key-one: value-three - key-one: value-four + key-one: value-three + key-one: value-four """ .trimIndent() @@ -357,7 +357,7 @@ class CommitParsersTest { fun `addFooters - subject that looks like a footer line`() { val message = """ - Market Explorer: Remove unused code + Market Explorer: Remove unused code """ .trimIndent() @@ -381,7 +381,7 @@ class CommitParsersTest { trimFooters( """ This is a subject - + key1: value1 """ @@ -397,7 +397,7 @@ class CommitParsersTest { trimFooters( """ This is a subject - + key1: value1 """ @@ -410,9 +410,9 @@ class CommitParsersTest { fun `trimFooters - subject and body only`() { val message = """ - This is a subject + This is a subject - This is a body + This is a body """ .trimIndent() @@ -433,12 +433,12 @@ class CommitParsersTest { fun `trimFooters - subject, body with footer-like lines`() { val message = """ - This is a subject + This is a subject - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two """ .trimIndent() @@ -462,15 +462,15 @@ class CommitParsersTest { fun `trimFooters - subject, body, existing footer lines`() { val message = """ - This is a subject + This is a subject - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two - - key-one: value-three - key-two: value-four + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two + + key-one: value-three + key-two: value-four """ .trimIndent() @@ -494,15 +494,15 @@ class CommitParsersTest { fun `trimFooters - subject, body, existing footer lines with multiples - last one wins`() { val message = """ - This is a subject + This is a subject - This is a body. - The following are still part of the body: - key-one: value-one - key-two: value-two - - key-one: value-three - key-one: value-four + This is a body. + The following are still part of the body: + key-one: value-one + key-two: value-two + + key-one: value-three + key-one: value-four """ .trimIndent() diff --git a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt index 11d7919..84834db 100644 --- a/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt +++ b/git-jaspr/src/test/kotlin/sims/michael/gitjaspr/GitJasprTest.kt @@ -137,7 +137,8 @@ interface GitJasprTest { """ |[ㄧㄧㄧㄧㄧㄧ] %s : three |[ㄧㄧㄧㄧㄧㄧ] %s : two - |[ㄧㄧㄧㄧㄧㄧ] %s : one""" + |[ㄧㄧㄧㄧㄧㄧ] %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -169,7 +170,8 @@ interface GitJasprTest { """ |[ㄧㄧㄧㄧㄧㄧ] %s : three |[ㄧㄧㄧㄧㄧㄧ] %s : two - |[✅ㄧㄧㄧㄧㄧ] %s : one""" + |[✅ㄧㄧㄧㄧㄧ] %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -206,7 +208,8 @@ interface GitJasprTest { """ |[ㄧㄧㄧㄧㄧㄧ] %s : three |[ㄧㄧㄧㄧㄧㄧ] %s : two - |[✅✅⌛✅ㄧㄧ] %s : %s : one""" + |[✅✅⌛✅ㄧㄧ] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -246,7 +249,8 @@ interface GitJasprTest { """ |[ㄧㄧㄧㄧㄧㄧ] %s : three |[ㄧㄧㄧㄧㄧㄧ] %s : two - |[✅✅✅✅ㄧㄧ] %s : %s : one""" + |[✅✅✅✅ㄧㄧ] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -303,7 +307,8 @@ interface GitJasprTest { """ |[✅✅✅✅ㄧㄧ] %s : %s : three |[✅✅✅✅ㄧㄧ] %s : %s : two - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -507,7 +512,8 @@ interface GitJasprTest { """ |[✅✅✅✅✅✅] %s : %s : three |[✅✅✅✅✅✅] %s : %s : two - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -569,7 +575,8 @@ interface GitJasprTest { """ |[✅✅✅ㄧ✅ㄧ] %s : %s : draft: three |[✅✅✅✅✅✅] %s : %s : two - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -628,7 +635,8 @@ interface GitJasprTest { """ |[✅✅✅✅ㄧㄧ] %s : %s : three |[✅✅✅✅✅ㄧ] %s : %s : two - |[✅✅✅✅ㄧㄧ] %s : %s : one""" + |[✅✅✅✅ㄧㄧ] %s : %s : one + """ .trimMargin() .toStatusString(actual), getActual = { actual }, @@ -686,7 +694,8 @@ interface GitJasprTest { """ |[✅✅✅✅ㄧㄧ] %s : %s : three |[✅✅❌✅ㄧㄧ] %s : %s : two - |[✅✅✅✅ㄧㄧ] %s : %s : one""" + |[✅✅✅✅ㄧㄧ] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -730,7 +739,8 @@ interface GitJasprTest { val actual = getAndPrintStatusString(RefSpec("development", "development")) assertEquals( """ - |[✅✅✅✅✅✅] %s : %s : three""" + |[✅✅✅✅✅✅] %s : %s : three + """ .trimMargin() .toStatusString(actual), actual, @@ -820,7 +830,8 @@ interface GitJasprTest { """ |[❗✅✅✅✅ㄧ] %s : %s : four |[❗✅✅✅✅ㄧ] %s : %s : three - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -861,7 +872,8 @@ interface GitJasprTest { |Some commits in your local stack have duplicate IDs: |- a: (one, two) |This is likely because you've based new commit messages off of those from other commits. - |Please correct this by amending the commits and deleting the commit-id lines, then retry your operation.""" + |Please correct this by amending the commits and deleting the commit-id lines, then retry your operation. + """ .trimMargin() .toStatusString(actual), actual, @@ -984,7 +996,8 @@ interface GitJasprTest { |[✅✅✅✅✅✅] %s : %s : four |[✅✅✅✅✅✅] %s : %s : three |[✅✅✅✅✅✅] %s : %s : two - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString(actual), actual, @@ -1036,7 +1049,8 @@ interface GitJasprTest { assertEquals( """ |[✅✅✅✅✅✅] %s : %s : two - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString(actual, NamedStackInfo(stackName, 0, 0, remoteName)), actual, @@ -1093,7 +1107,8 @@ interface GitJasprTest { assertEquals( """ - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString( actual, @@ -1167,7 +1182,8 @@ interface GitJasprTest { assertEquals( """ |[✅ㄧㄧㄧㄧㄧ] %s : two - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString( actual, @@ -1252,7 +1268,8 @@ interface GitJasprTest { assertEquals( """ |[✅ㄧㄧㄧㄧㄧ] %s : three - |[✅✅✅✅✅✅] %s : %s : one""" + |[✅✅✅✅✅✅] %s : %s : one + """ .trimMargin() .toStatusString( actual, @@ -1326,7 +1343,8 @@ interface GitJasprTest { | update-type: version-update:semver-minor |... | - |Signed-off-by: dependabot[bot] """ + |Signed-off-by: dependabot[bot] + """ .trimMargin() id = "" localRefs += "main" @@ -1372,7 +1390,7 @@ interface GitJasprTest { commit-id: 0 - """ + """ .trimIndent(), localGit.log("HEAD", maxCount = 1).single().fullMessage.withCommitIdZero(), ) @@ -1402,7 +1420,7 @@ interface GitJasprTest { commit-id: 0 - """ + """ .trimIndent(), localGit.log("HEAD", maxCount = 1).single().fullMessage.withCommitIdZero(), ) @@ -1984,7 +2002,7 @@ interface GitJasprTest { - %s - %s ⬅ - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -1996,7 +2014,7 @@ interface GitJasprTest { - %s ⬅ - %s - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2010,7 +2028,7 @@ interface GitJasprTest { - %s - %s - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), ), @@ -2077,7 +2095,7 @@ interface GitJasprTest { - %s - [01..Current](https://%s/%s/%s/compare/jaspr/main/E_01..jaspr/main/E) - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2096,7 +2114,7 @@ interface GitJasprTest { - %s - [01..Current](https://%s/%s/%s/compare/jaspr/main/E_01..jaspr/main/E) - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2115,7 +2133,7 @@ interface GitJasprTest { - %s - [01..Current](https://%s/%s/%s/compare/jaspr/main/E_01..jaspr/main/E) - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2129,7 +2147,7 @@ interface GitJasprTest { - %s - %s - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2148,7 +2166,7 @@ interface GitJasprTest { - %s ⬅ - [01..Current](https://%s/%s/%s/compare/jaspr/main/E_01..jaspr/main/E) - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2167,7 +2185,7 @@ interface GitJasprTest { - %s - [01..Current](https://%s/%s/%s/compare/jaspr/main/E_01..jaspr/main/E) - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2186,7 +2204,7 @@ interface GitJasprTest { - %s - [01..Current](https://%s/%s/%s/compare/jaspr/main/E_01..jaspr/main/E) - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), ), @@ -2256,7 +2274,7 @@ interface GitJasprTest { - %s - %s ⬅ - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2268,7 +2286,7 @@ interface GitJasprTest { - %s ⬅ - %s - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2280,7 +2298,7 @@ interface GitJasprTest { - %s - %s - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2292,7 +2310,7 @@ interface GitJasprTest { - %s - %s - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), """ @@ -2304,7 +2322,7 @@ interface GitJasprTest { - %s - %s - """ + """ .trimIndent() .toPrBodyString(actualIterator.next()), ), diff --git a/libs.versions.toml b/libs.versions.toml index d128f5c..f99aba3 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -4,7 +4,7 @@ kotlin = "2.3.0" kotlinpoet = "2.2.0" ksp = "2.3.4" jgit = "7.4.0.202509020913-r" -ktfmt = "0.58" +ktfmt = "0.60" [plugins] kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }