7
7
import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
8
8
import net .sf .jsqlparser .expression .operators .arithmetic .Multiplication ;
9
9
import net .sf .jsqlparser .schema .Column ;
10
+ import net .sf .jsqlparser .statement .Statements ;
10
11
import org .junit .After ;
11
12
import org .junit .AfterClass ;
13
+ import static org .junit .Assert .*;
12
14
import org .junit .Before ;
13
15
import org .junit .BeforeClass ;
14
16
import org .junit .Test ;
15
- import static org .junit .Assert .*;
16
17
17
18
/**
18
19
*
@@ -61,12 +62,12 @@ public void testParseExpression2() throws Exception {
61
62
assertTrue (mult .getLeftExpression () instanceof LongValue );
62
63
assertTrue (mult .getRightExpression () instanceof Parenthesis );
63
64
}
64
-
65
+
65
66
@ Test (expected = JSQLParserException .class )
66
67
public void testParseExpressionNonPartial () throws Exception {
67
68
Expression result = CCJSqlParserUtil .parseExpression ("a+" , false );
68
69
}
69
-
70
+
70
71
@ Test
71
72
public void testParseExpressionNonPartial2 () throws Exception {
72
73
Expression result = CCJSqlParserUtil .parseExpression ("a+" , true );
@@ -78,28 +79,45 @@ public void testParseCondExpression() throws Exception {
78
79
Expression result = CCJSqlParserUtil .parseCondExpression ("a+b>5 and c<3" );
79
80
assertEquals ("a + b > 5 AND c < 3" , result .toString ());
80
81
}
81
-
82
+
82
83
@ Test
83
84
public void testParseCondExpressionNonPartial () throws Exception {
84
85
Expression result = CCJSqlParserUtil .parseCondExpression ("x=92 and y=29" , false );
85
86
assertEquals ("x = 92 AND y = 29" , result .toString ());
86
87
}
87
-
88
+
88
89
@ Test (expected = JSQLParserException .class )
89
90
public void testParseCondExpressionNonPartial2 () throws Exception {
90
91
Expression result = CCJSqlParserUtil .parseCondExpression ("x=92 lasd y=29" , false );
91
92
System .out .println (result .toString ());
92
93
}
93
-
94
+
94
95
@ Test
95
96
public void testParseCondExpressionPartial2 () throws Exception {
96
97
Expression result = CCJSqlParserUtil .parseCondExpression ("x=92 lasd y=29" , true );
97
98
assertEquals ("x = 92" , result .toString ());
98
99
}
99
-
100
+
100
101
@ Test
101
102
public void testParseCondExpressionIssue471 () throws Exception {
102
103
Expression result = CCJSqlParserUtil .parseCondExpression ("(SSN,SSM) IN ('11111111111111', '22222222222222')" );
103
104
assertEquals ("(SSN, SSM) IN ('11111111111111', '22222222222222')" , result .toString ());
104
105
}
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
+ }
105
123
}
0 commit comments