Skip to content

Commit

Permalink
Add test case for LIKE ... ESCAPE.
Browse files Browse the repository at this point in the history
  • Loading branch information
julianhyde committed Oct 15, 2014
1 parent a47ed3e commit ee903d5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/src/test/java/org/eigenbase/sql/test/SqlOperatorBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2980,6 +2980,18 @@ protected static Calendar getCalendarNotTooNear(int timeUnit) {
tester.checkBoolean("'abc' not like '_b_'", Boolean.FALSE);
}

@Test public void testLikeEscape() {
tester.setFor(SqlStdOperatorTable.LIKE);
tester.checkBoolean("'a_c' like 'a#_c' escape '#'", Boolean.TRUE);
tester.checkBoolean("'axc' like 'a#_c' escape '#'", Boolean.FALSE);
tester.checkBoolean("'a_c' like 'a\\_c' escape '\\'", Boolean.TRUE);
tester.checkBoolean("'axc' like 'a\\_c' escape '\\'", Boolean.FALSE);
tester.checkBoolean("'a%c' like 'a\\%c' escape '\\'", Boolean.TRUE);
tester.checkBoolean("'a%cde' like 'a\\%c_e' escape '\\'", Boolean.TRUE);
tester.checkBoolean("'abbc' like 'a%c' escape '\\'", Boolean.TRUE);
tester.checkBoolean("'abbc' like 'a\\%c' escape '\\'", Boolean.FALSE);
}

@Test public void testLikeOperator() {
tester.setFor(SqlStdOperatorTable.LIKE);
tester.checkBoolean("'' like ''", Boolean.TRUE);
Expand Down

0 comments on commit ee903d5

Please sign in to comment.