use of io.airlift.joni.Regex in project presto by prestodb.
the class TestLikeFunctions method testSelfEscaping.
@Test
public void testSelfEscaping() throws Exception {
Regex regex = likePattern(utf8Slice("\\\\abc\\%"), utf8Slice("\\"));
assertTrue(like(utf8Slice("\\abc%"), regex));
}
use of io.airlift.joni.Regex in project presto by prestodb.
the class TestLikeFunctions method testLikeNewlineInMatch.
@Test
public void testLikeNewlineInMatch() {
Regex regex = likePattern(utf8Slice("f%b%"));
assertTrue(like(utf8Slice("foo\nbar"), regex));
}
use of io.airlift.joni.Regex in project presto by prestodb.
the class TestLikeFunctions method testLikeNewlineBeforeMatch.
@Test
public void testLikeNewlineBeforeMatch() {
Regex regex = likePattern(utf8Slice("%b%"));
assertTrue(like(utf8Slice("foo\nbar"), regex));
}
use of io.airlift.joni.Regex in project presto by prestodb.
the class TestLikeFunctions method testLikeInvalidUtf8Value.
@SuppressWarnings("NumericCastThatLosesPrecision")
@Test(timeOut = 1000)
public void testLikeInvalidUtf8Value() {
Slice value = Slices.wrappedBuffer(new byte[] { 'a', 'b', 'c', (byte) 0xFF, 'x', 'y' });
Regex regex = likePattern(utf8Slice("%b%"), utf8Slice("\\"));
assertTrue(like(value, regex));
}
use of io.airlift.joni.Regex in project presto by prestodb.
the class TestLikeFunctions method testLikeUtf8Pattern.
@Test(timeOut = 1000)
public void testLikeUtf8Pattern() {
Regex regex = likePattern(utf8Slice("%名誉%"), utf8Slice("\\"));
assertFalse(like(utf8Slice("foo"), regex));
}
Aggregations