Skip to content

Commit

Permalink
test: add more test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Reichel <andreas@manticore-projects.com>
  • Loading branch information
manticore-projects committed Apr 18, 2024
1 parent 063d244 commit ced6ace
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,34 @@ void testSQLServerSetStatementIssue1984() throws JSQLParserException {
String sqlStr = "SET IDENTITY_INSERT tb_inter_d2v_transfer on";
Statements statements = CCJSqlParserUtil.parseStatements(sqlStr,
parser -> parser.withUnsupportedStatements(true));
Assertions.assertEquals(1, statements.size());
Assertions.assertInstanceOf(UnsupportedStatement.class, statements.get(0));
assertEquals(1, statements.size());
assertInstanceOf(UnsupportedStatement.class, statements.get(0));

TestUtils.assertStatementCanBeDeparsedAs(statements.get(0), sqlStr, true);

Statement statement = CCJSqlParserUtil.parse(sqlStr,
parser -> parser.withUnsupportedStatements(true));
Assertions.assertInstanceOf(UnsupportedStatement.class, statement);
assertInstanceOf(UnsupportedStatement.class, statement);

TestUtils.assertStatementCanBeDeparsedAs(statement, sqlStr, true);
}

@Test
void testInformixSetStatementIssue1945() throws JSQLParserException {
String sqlStr = "set isolation to dirty read;";
Statement statement = CCJSqlParserUtil.parse(sqlStr,
parser -> parser.withUnsupportedStatements(true));
assertInstanceOf(UnsupportedStatement.class, statement);
TestUtils.assertStatementCanBeDeparsedAs(statement, sqlStr, true);

TestUtils.assertSqlCanBeParsedAndDeparsed(
"set isolation to dirty read;", true, parser -> parser.withUnsupportedStatements());
}

@Test
void testRedshiftSetStatementIssue1708() throws JSQLParserException {
Statement st = TestUtils.assertSqlCanBeParsedAndDeparsed(
"SET x TO y;", true, parser -> parser.withUnsupportedStatements());
assertInstanceOf(UnsupportedStatement.class, st);
}
}

0 comments on commit ced6ace

Please sign in to comment.