chore: eliminate all Kotlin compiler warnings in main source (#877)
* chore: eliminate all Kotlin compiler warnings in main source * test(chat): fix cross-class coroutine leaks poisoning the unit suite - ChatUpdateCommandTest: inject FakeSlashUsageStore — the real DataStore store inits on real IO threads with a relaxed-mock app (cacheDir NPE) and leaks an uncaught exception into the next runTest class. - ChatUpdateCommandTest + SlashCommandDispatchRpcTest: mock ProfileSwitchCoordinator.switched (ChatViewModelTest pattern) — VMs otherwise park collectors on the singleton flow that crash later classes (ProfileSwitchCoordinatorTest) on stale-Main resumption. Full suite: 944 tests, 0 failures (was 2 flaky per run). --------- Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
b05cffa9c4
commit
1e6e248891
14 files changed
+88
-38
No files matched your search
@@ -31,24 +31,34 @@ object LocaleContextWrapper {
|
||||
|
||||
code.contains("-r", ignoreCase = true) -> {
|
||||
val parts = code.split("-r", ignoreCase = true)
|
||||
Locale(parts[0], parts.getOrElse(1) { "" })
|
||||
localeFor(parts[0], parts.getOrElse(1) { "" })
|
||||
}
|
||||
|
||||
code.contains("-") -> {
|
||||
val parts = code.split("-")
|
||||
Locale(parts[0], parts.getOrElse(1) { "" })
|
||||
localeFor(parts[0], parts.getOrElse(1) { "" })
|
||||
}
|
||||
|
||||
code.contains("_") -> {
|
||||
val parts = code.split("_")
|
||||
Locale(parts[0], parts.getOrElse(1) { "" })
|
||||
localeFor(parts[0], parts.getOrElse(1) { "" })
|
||||
}
|
||||
|
||||
else -> {
|
||||
Locale(code)
|
||||
Locale.forLanguageTag(code)
|
||||
}
|
||||
}
|
||||
|
||||
private fun localeFor(
|
||||
language: String,
|
||||
region: String,
|
||||
): Locale =
|
||||
if (region.isEmpty()) {
|
||||
Locale.forLanguageTag(language)
|
||||
} else {
|
||||
Locale.forLanguageTag("$language-$region")
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap [base] so the configuration carries [locale].
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user