mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-07-03 22:07:24 +00:00
refactor(config): 重构 AppPaths 的构造方法, 应对将来 Kotlin 更新中的特性.
先前的方法是利用了初始化与调用的顺序, 来实现的 Supplier 互补(虽然在代码中, 确实存在未初始化调用的情况, 但实际运行的时候, 会先初始化, 再调用 Supplier), 但是未来 Kotlin 的更新中,编译器会把这个操作视为未初始化错误, 所以在这次改动中修复掉这个 bug 操作.
This commit is contained in:
@ -21,6 +21,17 @@ import kotlin.test.*
|
||||
|
||||
internal class AppPathsTest {
|
||||
|
||||
@Test
|
||||
fun `Consistency check`() {
|
||||
for (path in AppPaths.values()) {
|
||||
assertEquals(
|
||||
File(path.path).canonicalPath,
|
||||
path.file.canonicalPath,
|
||||
"路径 File 与 Path 不一致: ${path.name}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Data root path priority`() {
|
||||
System.setProperty(AppPaths.PathConst.PROP_DATA_PATH, "fromSystemProperties")
|
||||
|
Reference in New Issue
Block a user