mirror of
https://github.com/ReVanced/revanced-library.git
synced 2026-01-11 13:56:17 +00:00
chore: Fix builds from bumping dependencies
This commit is contained in:
@@ -3,8 +3,9 @@ package app.revanced.library
|
||||
import app.revanced.library.Options.setOptions
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.options.types.BooleanPatchOption.Companion.booleanPatchOption
|
||||
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||
import org.junit.jupiter.api.MethodOrderer
|
||||
import org.junit.jupiter.api.Order
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -35,9 +36,10 @@ internal object PatchOptionsTest {
|
||||
private const val CHANGED_JSON =
|
||||
"[{\"patchName\":\"PatchOptionsTestPatch\",\"options\":[{\"key\":\"key1\",\"value\":\"test\"},{\"key\":\"key2\",\"value\":false}]}]"
|
||||
|
||||
object PatchOptionsTestPatch : BytecodePatch(name = "PatchOptionsTestPatch") {
|
||||
var option1 by stringPatchOption("key1", null, "title1", "description1")
|
||||
var option2 by booleanPatchOption("key2", true, "title2", "description2")
|
||||
@Patch("PatchOptionsTestPatch")
|
||||
object PatchOptionsTestPatch : BytecodePatch() {
|
||||
var option1 by stringPatchOption("key1", null, null, "title1", "description1")
|
||||
var option2 by booleanPatchOption("key2", true, null, "title2", "description2")
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Do nothing
|
||||
|
||||
@@ -3,6 +3,7 @@ package app.revanced.library
|
||||
import app.revanced.patcher.PatchSet
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import org.junit.jupiter.api.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
@@ -42,9 +43,16 @@ internal object PatchUtilsTest {
|
||||
expected: String?, patches: PatchSet, compatiblePackageName: String
|
||||
) = assertEquals(expected, PatchUtils.getMostCommonCompatibleVersion(patches, compatiblePackageName))
|
||||
|
||||
private fun newPatch(packageName: String, vararg versions: String) = object : BytecodePatch(
|
||||
compatiblePackages = setOf(CompatiblePackage(packageName, versions.toSet()))
|
||||
) {
|
||||
private fun newPatch(packageName: String, vararg versions: String) = object : BytecodePatch() {
|
||||
init {
|
||||
// Set the compatible packages field to the supplied package name and versions reflectively,
|
||||
// because the setter is private but needed for testing.
|
||||
val compatiblePackagesField = Patch::class.java.getDeclaredField("compatiblePackages")
|
||||
|
||||
compatiblePackagesField.isAccessible = true
|
||||
compatiblePackagesField.set(this, setOf(CompatiblePackage(packageName, versions.toSet())))
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user