Add a test for the 500-char changelog limit

Both F-Droid and Google Play cap release notes at 500 characters. Check every
metadata changelog in the unit test suite (which CI already runs), and trim the
two old Flutter changelogs that were over the limit.
This commit is contained in:
austinried
2026-10-04 00:30:08 +00:00
parent 3ead9f6fb6
commit 4bf34ea20a
3 changed files with 44 additions and 19 deletions
@@ -0,0 +1,33 @@
package com.subtracks.metadata
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
class ChangelogTest {
@Test
fun changelogsFitStoreLimit() {
val root =
generateSequence(File(".").canonicalFile) { it.parentFile }
.first { File(it, "settings.gradle.kts").isFile }
val files =
File(root, "metadata")
.listFiles()
.orEmpty()
.flatMap { locale -> File(locale, "changelogs").listFiles().orEmpty().toList() }
.filter { it.isFile && it.extension == "txt" }
assertTrue("no changelog files found under metadata/", files.isNotEmpty())
files.forEach { file ->
val text = file.readText()
val length = text.codePointCount(0, text.length)
assertTrue(
"metadata changelogs must be at most $LIMIT characters; ${file.name} is $length",
length <= LIMIT,
)
}
}
private companion object {
const val LIMIT = 500
}
}