forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved escaping wildcard test to common/utils
Signed-off-by: Guian Gumpac <[email protected]>
- Loading branch information
Guian Gumpac
committed
Nov 25, 2022
1 parent
86fa737
commit b54a934
Showing
3 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
common/src/test/java/org/opensearch/sql/common/utils/ConvertSQLWildcardTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.common.utils; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class ConvertSQLWildcardTest { | ||
@Test | ||
public void test_escaping_sql_wildcards() { | ||
assertEquals("%", StringUtils.convertSqlWildcardToLucene("\\%")); | ||
assertEquals("\\*", StringUtils.convertSqlWildcardToLucene("\\*")); | ||
assertEquals("_", StringUtils.convertSqlWildcardToLucene("\\_")); | ||
assertEquals("\\?", StringUtils.convertSqlWildcardToLucene("\\?")); | ||
assertEquals("%*", StringUtils.convertSqlWildcardToLucene("\\%%")); | ||
assertEquals("*%", StringUtils.convertSqlWildcardToLucene("%\\%")); | ||
assertEquals("%*%", StringUtils.convertSqlWildcardToLucene("\\%%\\%")); | ||
assertEquals("*%*", StringUtils.convertSqlWildcardToLucene("%\\%%")); | ||
assertEquals("_?", StringUtils.convertSqlWildcardToLucene("\\__")); | ||
assertEquals("?_", StringUtils.convertSqlWildcardToLucene("_\\_")); | ||
assertEquals("_?_", StringUtils.convertSqlWildcardToLucene("\\__\\_")); | ||
assertEquals("?_?", StringUtils.convertSqlWildcardToLucene("_\\__")); | ||
assertEquals("%\\*_\\?", StringUtils.convertSqlWildcardToLucene("\\%\\*\\_\\?")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters