Merge branch '6.0.x'

This commit is contained in:
Sam Brannen
2023-09-29 17:48:15 +02:00
3 changed files with 17 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ import org.springframework.expression.spel.standard.SpelExpression;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.expression.spel.SpelMessage.MAX_CONCATENATED_STRING_LENGTH_EXCEEDED;
import static org.springframework.expression.spel.SpelMessage.MAX_REPEATED_TEXT_SIZE_EXCEEDED;
import static org.springframework.expression.spel.SpelMessage.NEGATIVE_REPEATED_TEXT_COUNT;
/**
* Tests the evaluation of expressions using various operators.
@@ -587,6 +588,13 @@ class OperatorTests extends AbstractExpressionTests {
evaluateAndCheckError("'ab' * " + repeatCount, String.class, MAX_REPEATED_TEXT_SIZE_EXCEEDED, 5);
}
@Test
void stringRepeatWithNegativeRepeatCount() {
// 4 is the position of the '*' (repeat operator)
// -1 is the negative repeat count
evaluateAndCheckError("'a' * -1", String.class, NEGATIVE_REPEATED_TEXT_COUNT, 4, -1);
}
@Test
void stringConcatenation() {
evaluate("'' + ''", "", String.class);