整理:单元测试优化

This commit is contained in:
pppscn 2024-03-28 22:20:12 +08:00
parent 75b356246c
commit e131690ac7
4 changed files with 9 additions and 0 deletions

1
.gitignore vendored
View File

@ -38,3 +38,4 @@
/*.txt
/pic/Troubleshooting_Process.vsdx
/pic/working_principle_en.drawio
/app/src/test

View File

@ -39,6 +39,10 @@ android {
buildToolsVersion build_versions.build_tools
compileSdkVersion build_versions.target_sdk
testOptions {
unitTests.returnDefaultValues = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -1,6 +1,7 @@
package com.idormy.sms.forwarder.utils
import android.content.Context
import android.os.Build
import com.idormy.sms.forwarder.App
import java.io.File
import java.io.FileWriter
@ -40,6 +41,8 @@ object Log {
}
fun logToFile(level: String, tag: String, message: String) {
if (Build.DEVICE == null) return
if (!::appContext.isInitialized) {
throw IllegalStateException("Log not initialized. Call init(context) first.")
}

View File

@ -13,6 +13,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# org.gradle.parallel=true
# 是否打包APK打正式包时请设置为true,使用正式的签名
isNeedPackage=true
isNeedClean=false
# 是否排除Frpc动态库打正式包时请设置为true
excludeFrpclib=true
# 是否使用leakcanary检测内存泄漏打正式包时请设置为false