1
mirror of https://github.com/revanced/revanced-patcher synced 2025-02-25 00:15:24 +01:00

fix: add imports to fix failing tests

This commit is contained in:
oSumAtrIX 2023-06-10 01:43:09 +02:00
parent cea9379b32
commit 43d6868d1f
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -1,5 +1,13 @@
package app.revanced.patcher.extensions package app.revanced.patcher.extensions
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
@ -133,7 +141,7 @@ private object InstructionExtensionsTest {
@Test @Test
fun addSmaliInstructionsWithExternalLabelToMethodIndexed() = applyOnMethod { fun addSmaliInstructionsWithExternalLabelToMethodIndexed() = applyOnMethod {
val label = ExternalLabel("testLabel", instruction(5)) val label = ExternalLabel("testLabel", getInstruction(5))
addInstructionsWithLabels( addInstructionsWithLabels(
5, 5,
@ -144,7 +152,7 @@ private object InstructionExtensionsTest {
assertRegisterIs(1, 6) assertRegisterIs(1, 6)
assertRegisterIs(5, 8) assertRegisterIs(5, 8)
val gotoTarget = instruction<BuilderOffsetInstruction>(7) val gotoTarget = getInstruction<BuilderOffsetInstruction>(7)
.target.location.instruction as OneRegisterInstruction .target.location.instruction as OneRegisterInstruction
assertEquals(5, gotoTarget.registerA) assertEquals(5, gotoTarget.registerA)
@ -205,7 +213,7 @@ private object InstructionExtensionsTest {
} }
private fun MutableMethodImplementation.assertRegisterIs(register: Int, atIndex: Int) = assertEquals( private fun MutableMethodImplementation.assertRegisterIs(register: Int, atIndex: Int) = assertEquals(
register, instruction<OneRegisterInstruction>(atIndex).registerA register, getInstruction<OneRegisterInstruction>(atIndex).registerA
) )
private fun MutableMethod.assertRegisterIs(register: Int, atIndex: Int) = private fun MutableMethod.assertRegisterIs(register: Int, atIndex: Int) =