-
-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent cancelling of Swim Toggle event (#7066)
- Loading branch information
Showing
4 changed files
with
112 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/test/java/org/skriptlang/skript/test/tests/syntaxes/effects/EffCancelEventTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.skriptlang.skript.test.tests.syntaxes.effects; | ||
|
||
import ch.njol.skript.test.runner.SkriptJUnitTest; | ||
import org.junit.Test; | ||
|
||
public class EffCancelEventTest extends SkriptJUnitTest { | ||
|
||
static { | ||
setShutdownDelay(1); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
spawnTestPig(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
test "EffCancelEventJUnit" when running JUnit: | ||
set {_tests::1} to "event not cancelled by default" | ||
set {_tests::2} to "cancel event" | ||
set {_tests::3} to "uncancel event" | ||
|
||
ensure junit test "org.skriptlang.skript.test.tests.syntaxes.effects.EffCancelEventTest" completes {_tests::*} | ||
|
||
on spawn of pig: | ||
set {_test} to "org.skriptlang.skript.test.tests.syntaxes.effects.EffCancelEventTest" | ||
junit test is {_test} | ||
|
||
if event is not cancelled: | ||
complete objective "event not cancelled by default" for {_test} | ||
|
||
cancel event | ||
if event is cancelled: | ||
complete objective "cancel event" for {_test} | ||
|
||
uncancel event | ||
if event is not cancelled: | ||
complete objective "uncancel event" for {_test} |
26 changes: 26 additions & 0 deletions
26
src/test/skript/tests/regressions/7054-update event cancelling.sk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
parse: | ||
results: {PlayerLogin::parse::*} | ||
code: | ||
on connect: | ||
cancel event | ||
|
||
parse: | ||
results: {PlayerQuit::parse::*} | ||
code: | ||
on quit: | ||
cancel event | ||
|
||
parse: | ||
results: {SwimToggle::parse::*} | ||
code: | ||
on swim toggle: | ||
cancel event | ||
|
||
test "cancelling swim toggle": | ||
assert {SwimToggle::parse::*} contains "Cancelling a toggle swim event has no effect" with "cancelling swim toggle doesn't error" | ||
|
||
test "cancelling player login": | ||
assert {PlayerLogin::parse::*} contains "A connect event cannot be cancelled, but the player may be kicked ('kick player by reason of ""...""')" with "cancelling player login doesn't error" | ||
|
||
test "cancelling regular event": | ||
assert {PlayerQuit::parse::*} contains "An on quit event cannot be cancelled" with "cancelling regular event doesn't error" |