Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: formatting
  • Loading branch information
dengliming committed Dec 23, 2024
commit 83a157f4e6ee97625f76f1fa71fc8504b76a59f7
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
*/
package net.sf.jsqlparser.expression.operators.relational;

import static org.junit.jupiter.api.Assertions.*;

import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.StringValue;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.test.TestUtils;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
*
* @author Tobias Warneke (t.warneke@gmx.net)
Expand Down Expand Up @@ -61,31 +61,41 @@ void testDuckDBSimuilarTo() throws JSQLParserException {

@Test
public void testMatchAny() throws JSQLParserException {
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v MATCH_ANY 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v NOT MATCH_ANY 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v MATCH_ANY 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v NOT MATCH_ANY 'keyword1 keyword2'", true);
}

@Test
public void testMatchAll() throws JSQLParserException {
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v MATCH_ALL 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v NOT MATCH_ALL 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v MATCH_ALL 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v NOT MATCH_ALL 'keyword1 keyword2'", true);
}

@Test
public void testMatchPhrase() throws JSQLParserException {
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v MATCH_PHRASE 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v NOT MATCH_PHRASE 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v MATCH_PHRASE 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v NOT MATCH_PHRASE 'keyword1 keyword2'", true);
}

@Test
public void testMatchPhrasePrefix() throws JSQLParserException {
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v MATCH_PHRASE_PREFIX 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v NOT MATCH_PHRASE_PREFIX 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v MATCH_PHRASE_PREFIX 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v NOT MATCH_PHRASE_PREFIX 'keyword1 keyword2'", true);
}

@Test
public void testMatchRegexp() throws JSQLParserException {
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v MATCH_REGEXP 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed("select * from dual where v NOT MATCH_REGEXP 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v MATCH_REGEXP 'keyword1 keyword2'", true);
TestUtils.assertSqlCanBeParsedAndDeparsed(
"select * from dual where v NOT MATCH_REGEXP 'keyword1 keyword2'", true);
}
}