Ensure SpEL can compile an expression indexing into a boolean array

Closes gh-32400
This commit is contained in:
Sam Brannen
2024-03-08 15:29:42 +01:00
parent f6bc828569
commit fea1464562
2 changed files with 18 additions and 0 deletions

View File

@@ -308,6 +308,18 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertThat(getAst().getExitDescriptor()).isEqualTo("C");
}
@Test
void indexIntoPrimitiveBooleanArray() {
boolean[] booleans = { true, false };
expression = parser.parseExpression("[1]");
assertThat(expression.getValue(booleans)).isEqualTo(false);
assertCanCompile(expression);
assertThat(expression.getValue(booleans)).isEqualTo(false);
assertThat(getAst().getExitDescriptor()).isEqualTo("Z");
}
@Test
void indexIntoStringArray() {
String[] strings = { "a", "b", "c" };