77import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
88import net .sf .jsqlparser .expression .operators .arithmetic .Multiplication ;
99import net .sf .jsqlparser .schema .Column ;
10+ import net .sf .jsqlparser .statement .Statements ;
1011import org .junit .After ;
1112import org .junit .AfterClass ;
13+ import static org .junit .Assert .*;
1214import org .junit .Before ;
1315import org .junit .BeforeClass ;
1416import org .junit .Test ;
15- import static org .junit .Assert .*;
1617
1718/**
1819 *
@@ -61,12 +62,12 @@ public void testParseExpression2() throws Exception {
6162 assertTrue (mult .getLeftExpression () instanceof LongValue );
6263 assertTrue (mult .getRightExpression () instanceof Parenthesis );
6364 }
64-
65+
6566 @ Test (expected = JSQLParserException .class )
6667 public void testParseExpressionNonPartial () throws Exception {
6768 Expression result = CCJSqlParserUtil .parseExpression ("a+" , false );
6869 }
69-
70+
7071 @ Test
7172 public void testParseExpressionNonPartial2 () throws Exception {
7273 Expression result = CCJSqlParserUtil .parseExpression ("a+" , true );
@@ -78,28 +79,45 @@ public void testParseCondExpression() throws Exception {
7879 Expression result = CCJSqlParserUtil .parseCondExpression ("a+b>5 and c<3" );
7980 assertEquals ("a + b > 5 AND c < 3" , result .toString ());
8081 }
81-
82+
8283 @ Test
8384 public void testParseCondExpressionNonPartial () throws Exception {
8485 Expression result = CCJSqlParserUtil .parseCondExpression ("x=92 and y=29" , false );
8586 assertEquals ("x = 92 AND y = 29" , result .toString ());
8687 }
87-
88+
8889 @ Test (expected = JSQLParserException .class )
8990 public void testParseCondExpressionNonPartial2 () throws Exception {
9091 Expression result = CCJSqlParserUtil .parseCondExpression ("x=92 lasd y=29" , false );
9192 System .out .println (result .toString ());
9293 }
93-
94+
9495 @ Test
9596 public void testParseCondExpressionPartial2 () throws Exception {
9697 Expression result = CCJSqlParserUtil .parseCondExpression ("x=92 lasd y=29" , true );
9798 assertEquals ("x = 92" , result .toString ());
9899 }
99-
100+
100101 @ Test
101102 public void testParseCondExpressionIssue471 () throws Exception {
102103 Expression result = CCJSqlParserUtil .parseCondExpression ("(SSN,SSM) IN ('11111111111111', '22222222222222')" );
103104 assertEquals ("(SSN, SSM) IN ('11111111111111', '22222222222222')" , result .toString ());
104105 }
106+
107+ @ Test
108+ public void testParseStatementsIssue691 () throws Exception {
109+ Statements result = CCJSqlParserUtil .parseStatements (
110+ "select * from dual;\n "
111+ + "\n "
112+ + "select\n "
113+ + "*\n "
114+ + "from\n "
115+ + "dual;\n "
116+ + "\n "
117+ + "select *\n "
118+ + "from dual;" );
119+ assertEquals ("SELECT * FROM dual;\n "
120+ + "SELECT * FROM dual;\n "
121+ + "SELECT * FROM dual;\n " , result .toString ());
122+ }
105123}
0 commit comments