Skip to content
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

Add some test expressions #7142

Merged
merged 18 commits into from
Oct 26, 2024
Merged

Conversation

Efnilite
Copy link
Member

@Efnilite Efnilite commented Oct 10, 2024

Description

Adds some test expressions which I felt were missing.

  • test world can now be used instead of world "world"
  • test location can now be used instead of spawn of world "world"
  • test block can now be used instead of block at spawn of world "world"
  • All changed tests have no changed logic, except the block iterator test. This was changed to not fail since some other test forgot to reset the block to air, so it would've been a chest, failing the test.

Also adds event-world event value.


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@Efnilite Efnilite added enhancement Feature request, an issue about something that could be improved, or a PR improving something. unit testing For issues/PRs related to the Skript unit testing system. labels Oct 10, 2024
@NotSoDelayed
Copy link
Contributor

There’s event-location in tests

EventValues.registerEventValue(SkriptTestEvent.class, Block.class, new Getter<Block, SkriptTestEvent>() {
@Override
@Nullable
public Block get(SkriptTestEvent ignored) {
return SkriptJUnitTest.getBlock();
}
}, EventValues.TIME_NOW);
EventValues.registerEventValue(SkriptTestEvent.class, Location.class, new Getter<Location, SkriptTestEvent>() {
@Override
@Nullable
public Location get(SkriptTestEvent ignored) {
return SkriptJUnitTest.getTestLocation();
}
}, EventValues.TIME_NOW);
}

@Efnilite
Copy link
Member Author

There’s event-location in tests

EventValues.registerEventValue(SkriptTestEvent.class, Block.class, new Getter<Block, SkriptTestEvent>() {
@Override
@Nullable
public Block get(SkriptTestEvent ignored) {
return SkriptJUnitTest.getBlock();
}
}, EventValues.TIME_NOW);
EventValues.registerEventValue(SkriptTestEvent.class, Location.class, new Getter<Location, SkriptTestEvent>() {
@Override
@Nullable
public Location get(SkriptTestEvent ignored) {
return SkriptJUnitTest.getTestLocation();
}
}, EventValues.TIME_NOW);
}

this is used in like 5 tests, also test-location looks nicer :)

@TheLimeGlass
Copy link
Collaborator

I don't like the removal of the event-%classinfo% also could be used by external addons using the testing suite.

I don't mind having test-%classinfo% but I prefer event-%classinfo% more. I have no say, so I don't want to review this.

@TheLimeGlass TheLimeGlass removed their request for review October 11, 2024 18:59
@NotSoDelayed
Copy link
Contributor

I agree, removing event-* without a grace period is a breaking change.

Copy link
Member

@cheeezburga cheeezburga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good but no reason to remove the event values

Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some formatting

# Conflicts:
#	src/test/skript/tests/syntaxes/conditions/CondIsCharged.sk
#	src/test/skript/tests/syntaxes/effects/EffSpawn.sk
#	src/test/skript/tests/syntaxes/expressions/ExprEntities.sk
@Efnilite Efnilite added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Oct 26, 2024
@sovdeeth sovdeeth merged commit 13a38dc into SkriptLang:dev/feature Oct 26, 2024
5 checks passed
@Efnilite Efnilite deleted the test-expressions-1 branch October 27, 2024 11:20
@Efnilite Efnilite mentioned this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. unit testing For issues/PRs related to the Skript unit testing system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants