mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user