You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-06 16:38:50 +02:00
Compare commits
3 Commits
v11.0.0-de
...
v11.0.0-de
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ef2de35a74 | ||
![]() |
2a453d51a8 | ||
![]() |
43d6868d1f |
@@ -1,3 +1,10 @@
|
||||
# [11.0.0-dev.2](https://github.com/revanced/revanced-patcher/compare/v11.0.0-dev.1...v11.0.0-dev.2) (2023-06-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add imports to fix failing tests ([43d6868](https://github.com/revanced/revanced-patcher/commit/43d6868d1f59922f9812f3e4a2a890f3b331def6))
|
||||
|
||||
# [11.0.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v10.0.0...v11.0.0-dev.1) (2023-06-07)
|
||||
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 11.0.0-dev.1
|
||||
version = 11.0.0-dev.2
|
||||
|
@@ -1,5 +1,13 @@
|
||||
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.Companion.toMutable
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@@ -33,7 +41,7 @@ private object InstructionExtensionsTest {
|
||||
).let { testMethod = it.toMutable() }
|
||||
|
||||
@Test
|
||||
fun addInstructionsToImplementationIndexed() = applyOnImplementation {
|
||||
fun addInstructionsToImplementationIndexed() = applyToImplementation {
|
||||
addInstructions(5, getTestInstructions(5..6)).also {
|
||||
assertRegisterIs(5, 5)
|
||||
assertRegisterIs(6, 6)
|
||||
@@ -43,7 +51,7 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addInstructionsToImplementation() = applyOnImplementation {
|
||||
fun addInstructionsToImplementation() = applyToImplementation {
|
||||
addInstructions(getTestInstructions(10..11)).also {
|
||||
assertRegisterIs(10, 10)
|
||||
assertRegisterIs(11, 11)
|
||||
@@ -51,19 +59,19 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removeInstructionsFromImplementationIndexed() = applyOnImplementation {
|
||||
fun removeInstructionsFromImplementationIndexed() = applyToImplementation {
|
||||
removeInstructions(5, 5).also { assertRegisterIs(4, 4) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removeInstructionsFromImplementation() = applyOnImplementation {
|
||||
fun removeInstructionsFromImplementation() = applyToImplementation {
|
||||
removeInstructions(0).also { assertRegisterIs(9, 9) }
|
||||
removeInstructions(1).also { assertRegisterIs(1, 0) }
|
||||
removeInstructions(2).also { assertRegisterIs(3, 0) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun replaceInstructionsInImplementationIndexed() = applyOnImplementation {
|
||||
fun replaceInstructionsInImplementationIndexed() = applyToImplementation {
|
||||
replaceInstructions(5, getTestInstructions(0..1)).also {
|
||||
assertRegisterIs(0, 5)
|
||||
assertRegisterIs(1, 6)
|
||||
@@ -72,27 +80,27 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addInstructionToMethodIndexed() = applyOnMethod {
|
||||
fun addInstructionToMethodIndexed() = applyToMethod {
|
||||
addInstruction(5, TestInstruction(0)).also { assertRegisterIs(0, 5) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addInstructionToMethod() = applyOnMethod {
|
||||
fun addInstructionToMethod() = applyToMethod {
|
||||
addInstruction(TestInstruction(0)).also { assertRegisterIs(0, 10) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addSmaliInstructionToMethodIndexed() = applyOnMethod {
|
||||
fun addSmaliInstructionToMethodIndexed() = applyToMethod {
|
||||
addInstruction(5, getTestSmaliInstruction(0)).also { assertRegisterIs(0, 5) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addSmaliInstructionToMethod() = applyOnMethod {
|
||||
fun addSmaliInstructionToMethod() = applyToMethod {
|
||||
addInstruction(getTestSmaliInstruction(0)).also { assertRegisterIs(0, 10) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addInstructionsToMethodIndexed() = applyOnMethod {
|
||||
fun addInstructionsToMethodIndexed() = applyToMethod {
|
||||
addInstructions(5, getTestInstructions(0..1)).also {
|
||||
assertRegisterIs(0, 5)
|
||||
assertRegisterIs(1, 6)
|
||||
@@ -102,7 +110,7 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addInstructionsToMethod() = applyOnMethod {
|
||||
fun addInstructionsToMethod() = applyToMethod {
|
||||
addInstructions(getTestInstructions(0..1)).also {
|
||||
assertRegisterIs(0, 10)
|
||||
assertRegisterIs(1, 11)
|
||||
@@ -112,7 +120,7 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addSmaliInstructionsToMethodIndexed() = applyOnMethod {
|
||||
fun addSmaliInstructionsToMethodIndexed() = applyToMethod {
|
||||
addInstructionsWithLabels(5, getTestSmaliInstructions(0..1)).also {
|
||||
assertRegisterIs(0, 5)
|
||||
assertRegisterIs(1, 6)
|
||||
@@ -122,7 +130,7 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addSmaliInstructionsToMethod() = applyOnMethod {
|
||||
fun addSmaliInstructionsToMethod() = applyToMethod {
|
||||
addInstructions(getTestSmaliInstructions(0..1)).also {
|
||||
assertRegisterIs(0, 10)
|
||||
assertRegisterIs(1, 11)
|
||||
@@ -132,8 +140,8 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addSmaliInstructionsWithExternalLabelToMethodIndexed() = applyOnMethod {
|
||||
val label = ExternalLabel("testLabel", instruction(5))
|
||||
fun addSmaliInstructionsWithExternalLabelToMethodIndexed() = applyToMethod {
|
||||
val label = ExternalLabel("testLabel", getInstruction(5))
|
||||
|
||||
addInstructionsWithLabels(
|
||||
5,
|
||||
@@ -144,7 +152,7 @@ private object InstructionExtensionsTest {
|
||||
assertRegisterIs(1, 6)
|
||||
assertRegisterIs(5, 8)
|
||||
|
||||
val gotoTarget = instruction<BuilderOffsetInstruction>(7)
|
||||
val gotoTarget = getInstruction<BuilderOffsetInstruction>(7)
|
||||
.target.location.instruction as OneRegisterInstruction
|
||||
|
||||
assertEquals(5, gotoTarget.registerA)
|
||||
@@ -152,7 +160,7 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removeInstructionFromMethodIndexed() = applyOnMethod {
|
||||
fun removeInstructionFromMethodIndexed() = applyToMethod {
|
||||
removeInstruction(5).also {
|
||||
assertRegisterIs(4, 4)
|
||||
assertRegisterIs(6, 5)
|
||||
@@ -160,24 +168,24 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removeInstructionsFromMethodIndexed() = applyOnMethod {
|
||||
fun removeInstructionsFromMethodIndexed() = applyToMethod {
|
||||
removeInstructions(5, 5).also { assertRegisterIs(4, 4) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removeInstructionsFromMethod() = applyOnMethod {
|
||||
fun removeInstructionsFromMethod() = applyToMethod {
|
||||
removeInstructions(0).also { assertRegisterIs(9, 9) }
|
||||
removeInstructions(1).also { assertRegisterIs(1, 0) }
|
||||
removeInstructions(2).also { assertRegisterIs(3, 0) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun replaceInstructionInMethodIndexed() = applyOnMethod {
|
||||
fun replaceInstructionInMethodIndexed() = applyToMethod {
|
||||
replaceInstruction(5, TestInstruction(0)).also { assertRegisterIs(0, 5) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun replaceInstructionsInMethodIndexed() = applyOnMethod {
|
||||
fun replaceInstructionsInMethodIndexed() = applyToMethod {
|
||||
replaceInstructions(5, getTestInstructions(0..1)).also {
|
||||
assertRegisterIs(0, 5)
|
||||
assertRegisterIs(1, 6)
|
||||
@@ -186,7 +194,7 @@ private object InstructionExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun replaceSmaliInstructionsInMethodIndexed() = applyOnMethod {
|
||||
fun replaceSmaliInstructionsInMethodIndexed() = applyToMethod {
|
||||
replaceInstructions(5, getTestSmaliInstructions(0..1)).also {
|
||||
assertRegisterIs(0, 5)
|
||||
assertRegisterIs(1, 6)
|
||||
@@ -196,16 +204,16 @@ private object InstructionExtensionsTest {
|
||||
|
||||
// region Helper methods
|
||||
|
||||
private fun applyOnImplementation(block: MutableMethodImplementation.() -> Unit) {
|
||||
private fun applyToImplementation(block: MutableMethodImplementation.() -> Unit) {
|
||||
testMethodImplementation.apply(block)
|
||||
}
|
||||
|
||||
private fun applyOnMethod(block: MutableMethod.() -> Unit) {
|
||||
private fun applyToMethod(block: MutableMethod.() -> Unit) {
|
||||
testMethod.apply(block)
|
||||
}
|
||||
|
||||
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) =
|
||||
|
Reference in New Issue
Block a user