-
-
Notifications
You must be signed in to change notification settings - Fork 407
Match Any Default Expression #8089
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
Match Any Default Expression #8089
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remember to verify changes! most of the missing spaces would have be caught with a quick check
this method is also a good candidate for a junit test, since you can easily make an ExprInfo
I opted for a JUnit test of calling |
You shouldn't need to make it public, if the junit test is in the same package but under the test folder then it should be able to access package private methods. It's also better to test more methods than fewer, so having a test for the full thing would be good. |
src/test/java/org/skriptlang/skript/test/tests/lang/DefaultExpressionErrorTest.java
Outdated
Show resolved
Hide resolved
src/test/java/ch/njol/skript/lang/GetDefaultExpressionsTest.java
Outdated
Show resolved
Hide resolved
…bsolutionism/SkriptTest into dev/MultipleDefaultExpressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the rest of the tests in the classes
src/test/java/ch/njol/skript/lang/DefaultExpressionErrorTest.java
Outdated
Show resolved
Hide resolved
src/test/java/ch/njol/skript/lang/GetDefaultExpressionsTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good overall
Problem
When creating a
SyntaxElement
and including an optional multi-typed expression in the pattern ([%type1/type2%]
) then having adefaultExpression
for theClassInfo
oftype2
but not fortype1
,SkriptParser
fails to check if any of the types have adefaultExpression
.Resulting in a
SkriptAPIException
sincetype1
does not have adefaultExpression
Solution
Adds
#getDefaultExpressions
which will check everyClassInfo
ofExprInfo
to retrieve all availableDefaultExpressions
.Changes
#getDefaultExpression
to return the first object from#getDefaultExpression
When no
DefaultExpression
are available, combines error messages and codenames for 1SkriptAPIException
Testing Completed
manual
Supporting Information
N/A
Completes: #8079
Related: none