Search in sources :

Example 6 with 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));
}
Also used : Regex(io.airlift.joni.Regex) Test(org.testng.annotations.Test)

Example 7 with Regex

use of io.airlift.joni.Regex in project presto by prestodb.

the class TestLikeFunctions method testLikeNewlineInPattern.

@Test
public void testLikeNewlineInPattern() {
    Regex regex = likePattern(utf8Slice("%o\nbar"));
    assertTrue(like(utf8Slice("foo\nbar"), regex));
}
Also used : Regex(io.airlift.joni.Regex) Test(org.testng.annotations.Test)

Example 8 with Regex

use of io.airlift.joni.Regex in project presto by prestodb.

the class TestLikeFunctions method testBackslashesNoSpecialTreatment.

@Test
public void testBackslashesNoSpecialTreatment() throws Exception {
    Regex regex = likePattern(utf8Slice("\\abc\\/\\\\"));
    assertTrue(like(utf8Slice("\\abc\\/\\\\"), regex));
}
Also used : Regex(io.airlift.joni.Regex) Test(org.testng.annotations.Test)

Example 9 with Regex

use of io.airlift.joni.Regex in project presto by prestodb.

the class TestLikeFunctions method testLikeBasic.

@Test
public void testLikeBasic() {
    Regex regex = likePattern(utf8Slice("f%b__"));
    assertTrue(like(utf8Slice("foobar"), regex));
}
Also used : Regex(io.airlift.joni.Regex) Test(org.testng.annotations.Test)

Example 10 with Regex

use of io.airlift.joni.Regex in project presto by prestodb.

the class TestLikeFunctions method testAlternateEscapedCharacters.

@Test
public void testAlternateEscapedCharacters() throws Exception {
    Regex regex = likePattern(utf8Slice("xxx%x_abcxx"), utf8Slice("x"));
    assertTrue(like(utf8Slice("x%_abcx"), regex));
}
Also used : Regex(io.airlift.joni.Regex) Test(org.testng.annotations.Test)

Aggregations

Regex (io.airlift.joni.Regex)11 Test (org.testng.annotations.Test)11 Slice (io.airlift.slice.Slice)1 Slices.utf8Slice (io.airlift.slice.Slices.utf8Slice)1