Skip to content

Commit f6fa43a

Browse files
committed
Add testing instructions to README and enhance test case for library reference
1 parent 2142bcb commit f6fa43a

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,3 +908,7 @@ net.neoforged.gradle.caching.debug=<true/false>
908908
```
909909
The first property will log when a cache hit occurs, and the second property will log more information about the cache in general, including how hashes are calculated.
910910
If you are experiencing issues with the cache, you can enable these properties to get more information about what is happening.
911+
912+
## Testing
913+
This project has many tests.
914+
Do not run them locally, (unless scoped), but run them all in a PR scent.

userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/RunTests.groovy

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,53 @@ class RunTests extends BuilderBasedTestSpecification {
6060
run.checkModLoading()
6161
}
6262

63+
def "a mod with a library reference should be able to directly reference the runtype"() {
64+
given:
65+
def project = create("version_libs_runnable", {
66+
it.file("gradle/libs.versions.toml",
67+
"""
68+
[versions]
69+
# Neoforge Settings
70+
neoforge = "+"
71+
72+
[libraries]
73+
neoforge = { group = "net.neoforged", name = "neoforge", version.ref = "neoforge" }
74+
""".trim())
75+
76+
it.build("""
77+
java.toolchain.languageVersion = JavaLanguageVersion.of(${TestConstants.Latest.JavaVersion})
78+
79+
repositories {
80+
mavenCentral()
81+
}
82+
83+
dependencies {
84+
implementation(libs.neoforge)
85+
}
86+
87+
runs {
88+
server {
89+
environmentVariables.put('NEOFORGE_DEDICATED_SERVER_SELFTEST', "${(new Date()).format('ddMMyy_HHmm')}.json")
90+
arguments.add('--nogui')
91+
}
92+
}
93+
""")
94+
it.file("runs/server/eula.txt", """eula=true""")
95+
it.withToolchains()
96+
it.enableLocalBuildCache()
97+
it.withTemporaryGlobalCacheDirectory()
98+
it.withMod()
99+
})
100+
101+
when:
102+
def run = project.run {
103+
it.run()
104+
}
105+
106+
then:
107+
run.checkModLoading()
108+
}
109+
63110
def "configuring of the configurations after the dependencies block should work"() {
64111
given:
65112
def project = create("runs_configuration_after_dependencies", {

0 commit comments

Comments
 (0)