Skip to content

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

Open
wants to merge 11 commits into
base: dev/feature
Choose a base branch
from
Open

Conversation

F1r3w477
Copy link

@F1r3w477 F1r3w477 commented Jul 20, 2025

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

@F1r3w477 F1r3w477 requested a review from a team as a code owner July 20, 2025 00:29
@F1r3w477 F1r3w477 requested review from cheeezburga and erenkarakal and removed request for a team July 20, 2025 00:29
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 20, 2025
@F1r3w477
Copy link
Author

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.

@F1r3w477
Copy link
Author

nothing like finding a bug in your own pr... sigh...

@NotSoDelayed
Copy link
Contributor

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 💪

Copy link
Contributor

@NotSoDelayed NotSoDelayed left a 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

@F1r3w477 F1r3w477 requested a review from NotSoDelayed July 20, 2025 01:23
@F1r3w477
Copy link
Author

F1r3w477 commented Jul 20, 2025

oops, didn't mean to request review yet

I'll add the undefined var stuff

@Absolutionism Absolutionism added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Jul 20, 2025
@Absolutionism
Copy link
Contributor

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

@F1r3w477 F1r3w477 requested a review from Absolutionism July 20, 2025 05:29
@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jul 21, 2025
@F1r3w477 F1r3w477 requested a review from sovdeeth July 21, 2025 13:32
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants