-
-
Notifications
You must be signed in to change notification settings - Fork 413
Added some tests for existing syntax as well as an up to date test coverage list. #8264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TFSMads
wants to merge
4
commits into
SkriptLang:dev/feature
Choose a base branch
from
TFSMads:feature/tests
base: dev/feature
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5e86486
Added a couple of tests as well as an up to date test coverage list.
TFSMads 021b767
Rename incorrectly named test
TFSMads 650005c
Update EffMakeEggHatchTest.java
TFSMads c186aeb
Update src/test/java/org/skriptlang/skript/test/tests/syntaxes/effect…
TFSMads File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...est/java/org/skriptlang/skript/test/tests/syntaxes/effects/EffElytraBoostConsumeTest.java
This file contains hidden or 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,40 @@ | ||
| package org.skriptlang.skript.test.tests.syntaxes.effects; | ||
|
|
||
| import ch.njol.skript.aliases.Aliases; | ||
| import ch.njol.skript.aliases.ItemType; | ||
| import ch.njol.skript.test.runner.SkriptJUnitTest; | ||
| import com.destroystokyo.paper.event.player.PlayerElytraBoostEvent; | ||
| import org.bukkit.Bukkit; | ||
| import org.bukkit.entity.Firework; | ||
| import org.bukkit.entity.Player; | ||
| import org.bukkit.inventory.EquipmentSlot; | ||
| import org.bukkit.inventory.ItemStack; | ||
| import org.easymock.EasyMock; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
|
|
||
| public class EffElytraBoostConsumeTest extends SkriptJUnitTest { | ||
|
|
||
| static { | ||
| setShutdownDelay(1); | ||
| } | ||
|
|
||
| @Test | ||
| public void test() { | ||
| Player player = EasyMock.niceMock(Player.class); | ||
| Firework firework = EasyMock.niceMock(Firework.class); | ||
|
|
||
| ItemType itemType = Aliases.parseItemType("firework"); | ||
| Assert.assertNotNull("Could not parse firework item type", itemType); | ||
|
|
||
| ItemStack fireworkItemStack = itemType.getRandom(); | ||
| Assert.assertNotNull("Could not get firework item stack", fireworkItemStack); | ||
|
|
||
| PlayerElytraBoostEvent event = new PlayerElytraBoostEvent(player, fireworkItemStack,firework, EquipmentSlot.HAND); | ||
| Bukkit.getPluginManager().callEvent(event); | ||
|
|
||
| if(event.shouldConsume()) | ||
| Assert.fail("Firework should not be consumed"); | ||
| } | ||
|
|
||
| } | ||
31 changes: 31 additions & 0 deletions
31
src/test/java/org/skriptlang/skript/test/tests/syntaxes/effects/EffMakeEggHatchTest.java
This file contains hidden or 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,31 @@ | ||
| package org.skriptlang.skript.test.tests.syntaxes.effects; | ||
|
|
||
| import ch.njol.skript.test.runner.SkriptJUnitTest; | ||
| import org.bukkit.Bukkit; | ||
| import org.bukkit.entity.Egg; | ||
| import org.bukkit.entity.EntityType; | ||
| import org.bukkit.entity.Player; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.player.PlayerEggThrowEvent; | ||
| import org.easymock.EasyMock; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
|
|
||
| public class EffMakeEggHatchTest extends SkriptJUnitTest { | ||
|
|
||
| static { | ||
| setShutdownDelay(1); | ||
| } | ||
|
|
||
| @Test | ||
| public void test() { | ||
| Player player = EasyMock.niceMock(Player.class); | ||
| Egg egg = EasyMock.niceMock(Egg.class); | ||
| PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, egg, false, (byte) 0, EntityType.CHICKEN); | ||
| Bukkit.getPluginManager().callEvent(event); | ||
|
|
||
| if(!event.isHatching()) | ||
| Assert.fail("Egg should be hatching"); | ||
TFSMads marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.