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 parse structure for testing #6291

Merged
merged 4 commits into from Apr 13, 2024
Merged

Add parse structure for testing #6291

merged 4 commits into from Apr 13, 2024

Conversation

Pikachu920
Copy link
Member

Description

Adds a parse structure to allow testing structures for errors.


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

@Pikachu920 Pikachu920 added feature Pull request adding a new feature. unit testing For issues/PRs related to the Skript unit testing system. labels Jan 2, 2024
@Pikachu920
Copy link
Member Author

rather than allowing just a single section, i was thinking it might be better to parse anything in the code section a separate script (which can contain multiple structures). that way you can test for errors that depend on multiple structures are thrown (e.g. defining two commands of the same name).



@Name("Parse Structure")
@Description("Parses the code inside this structure as a structure and use 'parse logs' to grab any logs from it.")
Copy link
Member

Choose a reason for hiding this comment

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

a little more explanation on how to use would be nice. What should I put in results? Do I need a code entry? etc,

Copy link
Member

@AyhamAl-Ali AyhamAl-Ali left a comment

Choose a reason for hiding this comment

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

Very useful feature 👏

@AyhamAl-Ali AyhamAl-Ali added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Apr 5, 2024
broadcast "hi"

test "StructParse":
assert {StructParse::parse::*} contains """oops"" cannot be set to strings" with "StructParse error not found"
Copy link
Member

Choose a reason for hiding this comment

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

It sounds cool but I really honestly cannot tell what on earth is going on in your test, I think some more explanation or documentation for the feature might help (even some javadoc would be pretty cool).

Copy link
Member

Choose a reason for hiding this comment

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

It's indeed cool! He is using a nested StructParse with invalid store object "oops" that will throw an error and catching it for testing

@Moderocky Moderocky merged commit 441f770 into dev/feature Apr 13, 2024
5 checks passed
@Moderocky Moderocky deleted the feature/struct-parse branch April 13, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature. 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.

None yet

4 participants