Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ checkstyle {
}

task checkAliases {
group = 'skript'
description 'Checks for the existence of the aliases.'
doLast {
def aliasFolder = project.file('skript-aliases')
Expand Down Expand Up @@ -210,7 +211,7 @@ void createTestTask(String name, String desc, String environments, int javaVersi
if (modifiers.contains(Modifiers.DEV_MODE)) {
standardInput = System.in
}
group = 'execution'
group = 'skript'
classpath = files([
artifact,
project.configurations.runtimeClasspath.find { it.name.startsWith('gson') },
Expand Down Expand Up @@ -268,6 +269,7 @@ compileTestJava.options.encoding = 'UTF-8'
String environments = 'src/test/skript/environments/';
String env = project.property('testEnv') == null ? latestEnv : project.property('testEnv') + '.json'
int envJava = project.property('testEnvJavaVersion') == null ? latestJava : Integer.parseInt(project.property('testEnvJavaVersion') as String)

createTestTask('quickTest', 'Runs tests on one environment being the latest supported Java and Minecraft.', environments + latestEnv, latestJava, 0)
createTestTask('skriptTestJava21', 'Runs tests on all Java 21 environments.', environments + 'java21', java21, 0)
createTestTask('skriptTestJava17', 'Runs tests on all Java 17 environments.', environments + 'java17', java17, 0)
Expand All @@ -278,6 +280,7 @@ createTestTask('genReleaseDocs', 'Generates the Skript documentation website htm
tasks.register('skriptTest') {
description = 'Runs tests on all environments.'
dependsOn skriptTestJava17, skriptTestJava21
group = 'skript'
}

createTestTask('JUnitQuick', 'Runs JUnit tests on one environment being the latest supported Java and Minecraft.', environments + latestJUnitEnv, latestJUnitJava, 0, Modifiers.JUNIT)
Expand All @@ -286,6 +289,14 @@ createTestTask('JUnitJava17', 'Runs JUnit tests on all Java 17 environments.', e
tasks.register('JUnit') {
description = 'Runs JUnit tests on all environments.'
dependsOn JUnitJava17, JUnitJava21
group = 'skript'
}

tasks.register('quickTests') {
description = 'Runs quick test and junit quick.'
dependsOn quickTest
mustRunAfter JUnitQuick
group = 'skript'
}

// Build flavor configurations
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Done to increase the memory available to gradle.
# Ensure encoding is consistent across systems.
org.gradle.jvmargs=-Xmx1G -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx3G -Dfile.encoding=UTF-8
org.gradle.configureondemand=true
org.gradle.parallel=true

groupid=ch.njol
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/Skript.java
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ protected void afterErrors() {
try {
if (logHandler.getCount() == 0)
Skript.info(m_no_errors.toString());
if (scriptInfo.files == 0)
if (scriptInfo.files == 0 && !Skript.testing())
Skript.warning(m_no_scripts.toString());
if (Skript.logNormal() && scriptInfo.files > 0)
Skript.info(m_scripts_loaded.toString(
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/lang/default.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2207,6 +2207,8 @@ spawn reasons:
# 1.21
trial_spawner: trial spawner, trial mob spawner, trial creature spawner
enchantment: enchantment
# 1.21.8
rehydration: rehydration, rehydrate

# -- Difficulties --
difficulties:
Expand Down Expand Up @@ -2827,6 +2829,12 @@ types:
valued: valued thing¦s @a
containing: container¦s @a

# Testing
testgui: testgui
exemplus: exemplus
aardwolf: aardwolf
hoof: hoof

# Hooks
money: money
region: region¦s
Expand Down
34 changes: 34 additions & 0 deletions src/test/resources/runner_data/bukkit.yml.generic
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copy of 1.21.8

settings:
allow-end: false # Skript
warn-on-overload: false # Skript
permissions-file: permissions.yml
update-folder: update
plugin-profiling: false
connection-throttle: 4000
query-plugins: true
deprecated-verbose: default
shutdown-message: Server closed
minimum-api: none
use-map-color-cache: true
spawn-limits:
monsters: 70
animals: 10
water-animals: 5
water-ambient: 20
water-underground-creature: 5
axolotls: 5
ambient: 15
chunk-gc:
period-in-ticks: 600
ticks-per:
animal-spawns: 400
monster-spawns: 1
water-spawns: 1
water-ambient-spawns: 1
water-underground-creature-spawns: 1
axolotl-spawns: 1
ambient-spawns: 1
autosave: 6000
aliases: now-in-commands.yml
3 changes: 2 additions & 1 deletion src/test/skript/environments/java17/paper-1.19.4.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "paper-1.19.4",
"resources": [
{"source": "server.properties.generic", "target": "server.properties"}
{"source": "server.properties.generic", "target": "server.properties"},
{"source": "bukkit.yml.generic", "target": "bukkit.yml"}
],
"paperDownloads": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/test/skript/environments/java17/paper-1.20.4.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "paper-1.20.4",
"resources": [
{"source": "server.properties.generic", "target": "server.properties"}
{"source": "server.properties.generic", "target": "server.properties"},
{"source": "bukkit.yml.generic", "target": "bukkit.yml"}
],
"paperDownloads": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/test/skript/environments/java21/paper-1.20.6.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "paper-1.20.6",
"resources": [
{"source": "server.properties.generic", "target": "server.properties"}
{"source": "server.properties.generic", "target": "server.properties"},
{"source": "bukkit.yml.generic", "target": "bukkit.yml"}
],
"paperDownloads": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/test/skript/environments/java21/paper-1.21.3.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "paper-1.21.3",
"resources": [
{"source": "server.properties.generic", "target": "server.properties"}
{"source": "server.properties.generic", "target": "server.properties"},
{"source": "bukkit.yml.generic", "target": "bukkit.yml"}
],
"paperDownloads": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/test/skript/environments/java21/paper-1.21.4.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "paper-1.21.4",
"resources": [
{"source": "server.properties.generic", "target": "server.properties"}
{"source": "server.properties.generic", "target": "server.properties"},
{"source": "bukkit.yml.generic", "target": "bukkit.yml"}
],
"paperDownloads": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/test/skript/environments/java21/paper-1.21.5.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "paper-1.21.5",
"resources": [
{"source": "server.properties.generic", "target": "server.properties"}
{"source": "server.properties.generic", "target": "server.properties"},
{"source": "bukkit.yml.generic", "target": "bukkit.yml"}
],
"paperDownloads": [
{
Expand Down
3 changes: 2 additions & 1 deletion src/test/skript/environments/java21/paper-1.21.8.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "paper-1.21.8",
"resources": [
{"source": "server.properties.generic", "target": "server.properties"}
{"source": "server.properties.generic", "target": "server.properties"},
{"source": "bukkit.yml.generic", "target": "bukkit.yml"}
],
"paperDownloads": [
{
Expand Down
4 changes: 2 additions & 2 deletions src/test/skript/junit/EvtHarvestBlockTest.sk
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ options:
test: "org.skriptlang.skript.test.tests.syntaxes.events.EvtHarvestBlockTest"

test "EvtHarvestBlock" when running junit:
set {_tests::*} to "event plain - called", "event plain - player", "event plain - block", "event plain - equipment"
set {_tests::*} to "event plain - called", "event plain - player", "event plain - block" and "event plain - equipment"
add "event plain - drops" to {_tests::*}
add "event typed - called", "event typed - player", "event typed - block", "event typed - equipment" to {_tests::*}
add "event typed - called", "event typed - player", "event typed - block" and "event typed - equipment" to {_tests::*}
add "event typed - drops" to {_tests::*}

ensure {@test} completes {_tests::*}
Expand Down
2 changes: 1 addition & 1 deletion src/test/skript/tests/misc/effect commands.sk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test "effect commands":

# assume if something goes wrong we'll get an exception
execute console command "!broadcast ""effect commands test"""
execute console command "!set {test} to ""effect commands test"""
11 changes: 7 additions & 4 deletions src/test/skript/tests/misc/literal multiple infos warning.sk
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ parse:
function a():: object:
return unknown

function empty():
exit

test "literal multiple infos warning":
parse:
set {_test} to unknown
assert last parse logs matches {@error} with "Setting variable should throw warning"

parse:
if {_list::*} contains unknown:
broadcast "Filler"
empty()
assert last parse logs matches {@error} with "Contains should throw warning"

parse:
if the 1st element of {_list::*} is unknown:
broadcast "filler"
empty()
assert last parse logs matches {@error} with "Element of should throw warning"

parse:
Expand All @@ -32,7 +35,7 @@ test "literal multiple infos warning":
parse:
for each {_value} in {_list::*}:
if {_value} is unknown:
broadcast "filler"
empty()
assert last parse logs matches {@error} with "For each should throw warning"

assert {LiteralMultipleWarn::FunctionObject} matches {@error} with "Function with Object return type should throw warning"
Expand All @@ -43,7 +46,7 @@ parse:
code:
on damage:
if damage cause is unknown:
broadcast "filler"
empty()

parse:
results: {LiteralMultipleNoWarn::FunctionDamageCause}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
test "inventory holder location":
set {_b} to the test-block
set {_prev} to type of block at {_b}
broadcast {_prev}

set block at {_b} to a chest
set {_inv} to inventory of {_b}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test "broadcast evaluates vstrings twice":
broadcast "%func()%"
broadcast func() in the world "world"
assert {7718::calls} is 1 with "Called func() more than once"
delete {7718::calls}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test "CondIsWithin or lists":
set {_loc} to spawn of world "world"
loop 10 times:
assert {_loc} is within world "world", world "world_nether", or world "world_the_end" with "within or list failed"
assert {_loc} is within world "world", world "doesn't exist", or world "another" with "within or list failed"
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test "new custom model data expression" when running minecraft "1.21.4":

set model data strings of {_item} to "hello" and "world"
assert model data of {_item} is 456 with "wrong model data"
broadcast full model data of {_item}
assert full model data of {_item} is 456, 52, "hello", and "world" with "wrong full model data"
assert model data floats of {_item} is 456 and 52 with "wrong model data floats"
assert model data flags of {_item} is not set with "wrong model data flags"
Expand Down
1 change: 1 addition & 0 deletions src/test/skript/tests/syntaxes/expressions/ExprHash.sk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test "MD5 hash":
suppress deprecated syntax warning
assert "hello world" hashed with MD5 is "5eb63bbbe01eeed093cb22bb8f5acdc3" with "incorrect hash"

test "SHA-256 hash":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ test "vector between locations":
set {_vec} to vector between {_loc1} and {_loc2}
assert {_vec} is vector(10,10,10) with "vector between locations in same world failed (expected %vector(10,10,10)%, got %{_vec}%)"

set {_world2} to world("world_the_end")
assert {_world2} is set with "no end world found"
set {_loc3} to location(10,10,10,{_world2})
set {_vec2} to vector between {_loc1} and {_loc3}
assert {_vec2} is vector(10,10,10) with "vector between locations in different worlds failed (expected %vector(10,10,10)%, got %{_vec2}%)"

set {_vec3} to vector between {_loc1} and {_loc1}
assert {_vec3} is vector(0,0,0) with "vector between same locations failed (expected %vector(0,0,0)%, got %{_vec3}%)"
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
test "world environment":
assert environment of world "world" is normal with "main overworld was not environment ""normal"""
assert environment of world "world_the_end" is the end with "world_the_end was not environment ""the end"""
set {_environment} to environment of world "world"
assert {_environment} is overworld with "environment of world didn't compare with a variable"