HHH-18859 add a test for string slice operator

This commit is contained in:
Gavin King 2024-11-18 20:49:46 +01:00
parent cfc4b0a644
commit dd80b3e2a5
1 changed files with 17 additions and 0 deletions

View File

@ -2526,6 +2526,23 @@ public class FunctionTests {
);
}
@Test
public void testSlice(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
assertEquals("ring",
session.createSelectionQuery("select theString[3:6] from EntityOfBasics", String.class)
.getSingleResult());
assertEquals('s',
session.createSelectionQuery("select theString[1] from EntityOfBasics", Character.class)
.getSingleResult());
assertEquals('y',
session.createSelectionQuery("select theString[7] from EntityOfBasics", Character.class)
.getSingleResult());
}
);
}
@Test
@SkipForDialect(dialectClass = H2Dialect.class)
@SkipForDialect(dialectClass = DerbyDialect.class)