test: add test for multiple classes in jar

This commit is contained in:
Lucaskyy 2022-03-20 19:05:24 +01:00
parent 5f12bab5df
commit 6b1cec4a43
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89
4 changed files with 39 additions and 22 deletions

View File

@ -23,4 +23,7 @@ dependencies {
tasks.test { tasks.test {
useJUnitPlatform() useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
} }

View File

@ -14,7 +14,8 @@ import java.io.PrintStream
import kotlin.test.Test import kotlin.test.Test
internal class PatcherTest { internal class PatcherTest {
private val testSigs: Array<Signature> = arrayOf( companion object {
val testSigs: Array<Signature> = arrayOf(
// Java: // Java:
// public static void main(String[] args) { // public static void main(String[] args) {
// System.out.println("Hello, world!"); // System.out.println("Hello, world!");
@ -37,6 +38,7 @@ internal class PatcherTest {
) )
) )
) )
}
@Test @Test
fun testPatcher() { fun testPatcher() {
@ -127,7 +129,7 @@ internal class PatcherTest {
// TODO Doesn't work, needs to be fixed. // TODO Doesn't work, needs to be fixed.
//@Test //@Test
//fun noChanges() { //fun `test patcher with no changes`() {
// val testData = PatcherTest::class.java.getResourceAsStream("/test1.jar")!! // val testData = PatcherTest::class.java.getResourceAsStream("/test1.jar")!!
// val available = testData.available() // val available = testData.available()
// val patcher = Patcher(testData, testSigs) // val patcher = Patcher(testData, testSigs)

View File

@ -0,0 +1,12 @@
package net.revanced.patcher
import kotlin.test.Test
internal class ReaderTest {
@Test
fun `read jar containing multiple classes`() {
val testData = PatcherTest::class.java.getResourceAsStream("/test2.jar")!!
Patcher(testData, PatcherTest.testSigs) // reusing test sigs from PatcherTest
testData.close()
}
}

Binary file not shown.