Skip to content

Add expr ai test#8061

Merged
sovdeeth merged 12 commits intoSkriptLang:dev/featurefrom
F1r3w477:add-expr-ai-test
Nov 11, 2025
Merged

Add expr ai test#8061
sovdeeth merged 12 commits intoSkriptLang:dev/featurefrom
F1r3w477:add-expr-ai-test

Conversation

@F1r3w477
Copy link
Contributor

@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
Contributor 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
Contributor 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
Contributor 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
@skriptlang-automation skriptlang-automation bot added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Jul 28, 2025
Copy link
Member

@Efnilite Efnilite 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

@Efnilite Efnilite moved this to Awaiting Merge in 2.14 Releases Oct 26, 2025
@sovdeeth sovdeeth merged commit e9ac8d0 into SkriptLang:dev/feature Nov 11, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.14 Releases Nov 11, 2025
@skriptlang-automation skriptlang-automation bot added completed The issue has been fully resolved and the change will be in the next Skript update. and removed feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. labels Nov 11, 2025
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
* add ExprAI tests

* tab indent

* improve entity selection

* fix entity setting for multiple entities test

* add missing edge case

* end in new line

* add everyones suggestions

* entities to entity

* revert back to entites

* additional suggestions and requests

* remove test for undefined behavior
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
* add ExprAI tests

* tab indent

* improve entity selection

* fix entity setting for multiple entities test

* add missing edge case

* end in new line

* add everyones suggestions

* entities to entity

* revert back to entites

* additional suggestions and requests

* remove test for undefined behavior
@APickledWalrus APickledWalrus moved this from Done - Awaiting Release to Done - Released in 2.14 Releases Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something.

Projects

Status: Done - Released

Development

Successfully merging this pull request may close these issues.

5 participants

Comments