-
-
Notifications
You must be signed in to change notification settings - Fork 403
Add expr ai test #8061
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
base: dev/feature
Are you sure you want to change the base?
Add expr ai test #8061
Conversation
I just want to make sure the supporting information is noticed on this PR. The added test currently asserts for the observed behavior. If this behavior isn't expected, let me know and I can open an issue for it. |
nothing like finding a bug in your own pr... sigh... |
We all starts somewhere, besides I believe this is your first time contributing, so you attempting to make Skript better is a chad move 💪 |
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.
Suggestion on adding checks of interacting with an undefined variable
set ai of {_undefined} to false # nothing should happen without errors
set {_value} to ai of {_undefined} # variable stays undefined
oops, didn't mean to request review yet I'll add the undefined var stuff |
Also another thing, it's not required, but it's usually a safer bet to do spawn a cow at test-location:
set {_cow} to entity rather than spawn a cow at test-location
set {_cow} to last spawned entity |
Problem
The Skript project has low test coverage for its existing syntax, which increases the risk of regressions. The core ExprAI syntax for getting and setting an entity's AI status had no automated tests.
Solution
This PR introduces a test suite for ExprAI. The new test script verifies the following aspects of the expression:
Getting and setting the AI for single entities.
Handling lists of multiple entities.
Syntax aliases and patterns.
Boolean aliases.
Edge cases like setting to an unset value and querying a dead entity.
Testing Completed
Added the ExprAI.sk syntax test. The full project test suite was run via .\gradlew clean build and passed successfully.
Supporting Information
An interesting edge case was found during testing: querying the AI of an entity after it is killed returns true, not . The added test currently asserts for this observed behavior. This is open for discussion on whether this is the desired final functionality.
Edit: You can also set the AI of an entity after it has died.
Completes: none
Related: #6158