Skript icon indicating copy to clipboard operation
Skript copied to clipboard

add expr length tests

Open F1r3w477 opened this issue 6 months ago • 1 comments

Problem

The Skript project currently has very low test coverage for its existing syntax, making it difficult to ensure changes don't introduce regressions. Specifically, the core length of expression was untested.

Solution

This PR adds a new syntax test file, ExprLength.sk, to provide unit test coverage for the length of expressions.

The tests cover behavior for:

String literals and variables.

Edge cases like empty strings, whitespace, and Unicode characters.

Automatic type conversion from numbers.

The list-looping behavior when applied to a list of strings.

String interpolation.

Testing Completed

Added the ExprLength.sk test. The full test suite was run via .\gradlew skriptTest and passed successfully.

Supporting Information

None


Completes: none Related: #6158

F1r3w477 avatar Jul 18 '25 03:07 F1r3w477

[...] Maybe some tests using substring and joining.

I think substring and joining should be tested elsewhere. ie: ExprSubstring.sk should get created to test the substring. This file tests the length, and at the end of the day, we are checking the final length of a var/str/etc which is already covered in this test.

In ExprSubstring.sk we'd want to check that, when using substring, the length is as expected, but an issue here would probably be with ExprSubstring not ExprLength

F1r3w477 avatar Jul 18 '25 03:07 F1r3w477