Skip to content

Commit 298ff2f

Browse files
authored
Rework tests to actually work, update buildscript and dependencies (#71)
1 parent 71013f2 commit 298ff2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+667
-387
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
#gradle
1818
**/build
1919
**/.gradle
20+
/coremods-test/logs/

build.gradle

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import net.minecraftforge.gradleutils.PomUtils
22

33
plugins {
4-
id 'net.minecraftforge.licenser' version '1.0.1'
54
id 'idea'
65
id 'eclipse'
76
id 'java-library'
87
id 'maven-publish'
9-
id 'net.minecraftforge.gradleutils' version '[2.1.3,2.3.0)'
8+
alias libs.plugins.license
9+
//alias libs.plugins.versions
10+
alias libs.plugins.gradleutils
1011
}
1112

12-
group 'net.minecraftforge'
13+
group = 'net.minecraftforge'
1314
version = gradleutils.tagOffsetVersion
1415
println "Version: $version"
1516

@@ -25,7 +26,7 @@ repositories {
2526
}
2627

2728
changelog {
28-
fromTag "1.0.0"
29+
from '1.0.0'
2930
}
3031

3132
license {
@@ -34,25 +35,14 @@ license {
3435
}
3536

3637
dependencies {
37-
// TODO: Cleanup tests
38-
testImplementation('org.junit.jupiter:junit-jupiter-api:5.7.+')
39-
testImplementation('org.powermock:powermock-core:2.0.+')
40-
testImplementation('org.hamcrest:hamcrest-core:2.2')
41-
testImplementation('org.apache.logging.log4j:log4j-core:2.19.0')
42-
testImplementation(libs.modlauncher)
43-
testImplementation(libs.forgespi)
44-
testImplementation(libs.unsafe)
45-
testCompileOnly('org.jetbrains:annotations:21.0.1')
46-
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.7.+')
47-
testRuntimeOnly(project(':coremods-test-jar'))
48-
4938
compileOnly(libs.modlauncher)
5039
compileOnly(libs.securemodules)
5140
compileOnly(libs.log4j.api)
52-
api(libs.bundles.asm)
41+
compileOnly(libs.nulls)
5342
compileOnly(libs.forgespi)
43+
44+
api(libs.bundles.asm)
5445
implementation(libs.nashorn)
55-
compileOnly(libs.nulls)
5646
}
5747

5848
tasks.named('jar', Jar) {

coremods-test-jar/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
plugins {
2-
id 'net.minecraftforge.licenser' version '1.0.1'
32
id 'eclipse'
43
id 'java-library'
5-
id 'net.minecraftforge.gradleutils' version '[2.1.3,2.3.0)'
4+
alias libs.plugins.license
5+
//alias libs.plugins.versions
6+
alias libs.plugins.gradleutils
67
}
78

89
repositories {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright (c) Forge Development LLC
3+
* SPDX-License-Identifier: LGPL-2.1-only
4+
*/
5+
6+
open module net.minecraftforge.coremod.testjar {
7+
exports net.minecraftforge.coremod.testjar;
8+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) Forge Development LLC
3+
* SPDX-License-Identifier: LGPL-2.1-only
4+
*/
5+
6+
package net.minecraftforge.coremod.testjar;
7+
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
11+
public class Counter {
12+
private final List<Integer> counts = new ArrayList<>();
13+
14+
public Counter() {
15+
push();
16+
}
17+
18+
public int[] getCounts() {
19+
return counts.stream().mapToInt(Integer::intValue).toArray();
20+
}
21+
22+
public void push() {
23+
counts.add(0);
24+
}
25+
26+
public void increment() {
27+
counts.set(counts.size() - 1, counts.get(counts.size() - 1) + 1);
28+
}
29+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) Forge Development LLC
3+
* SPDX-License-Identifier: LGPL-2.1-only
4+
*/
5+
6+
package net.minecraftforge.coremod.testjar;
7+
8+
public class TestClass {
9+
public static boolean False() {
10+
return false;
11+
}
12+
13+
public static int[] testCounter() {
14+
var counts = new Counter();
15+
counts.push();
16+
return counts.getCounts();
17+
}
18+
19+
public static String testString() {
20+
return "raw";
21+
}
22+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) Forge Development LLC
3+
* SPDX-License-Identifier: LGPL-2.1-only
4+
*/
5+
6+
package net.minecraftforge.coremod.testjar;
7+
8+
// Marker class to let the arms length find the test resources
9+
public class TestMarker {
10+
}

coremods-test-jar/src/main/java/net/minecraftforge/coremods/testjar/RedirectClass.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

coremods-test-jar/src/main/java/net/minecraftforge/coremods/testjar/TestClass.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

coremods-test-jar/src/main/java/net/minecraftforge/coremods/testjar/TestTarget.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)