Skip to content

Commit 35608ba

Browse files
committed
improved function test
1 parent c3b4046 commit 35608ba

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/test/java/net/sf/jsqlparser/test/select/SelectTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.io.IOException;
2121
import java.io.StringReader;
22+
import static junit.framework.Assert.assertEquals;
2223

2324
import static net.sf.jsqlparser.test.TestUtils.*;
2425

@@ -895,6 +896,13 @@ public void testExtractFrom4() throws JSQLParserException {
895896
public void testProblemFunction() throws JSQLParserException {
896897
String stmt = "SELECT test() FROM testtable";
897898
assertSqlCanBeParsedAndDeparsed(stmt);
899+
Statement parsed = CCJSqlParserUtil.parse(stmt);
900+
Select select = (Select) parsed;
901+
PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
902+
SelectItem get = plainSelect.getSelectItems().get(0);
903+
SelectExpressionItem item = (SelectExpressionItem)get;
904+
assertTrue(item.getExpression() instanceof Function);
905+
assertEquals("test", ((Function)item.getExpression()).getName());
898906
}
899907

900908
public void testProblemFunction2() throws JSQLParserException {

0 commit comments

Comments
 (0)