@@ -132,6 +132,25 @@ public void readAndSplitScriptContainingComments() throws Exception {
132
132
assertEquals ("statement 4 not split correctly" , statement4 , statements .get (3 ));
133
133
}
134
134
135
+ @ Test
136
+ public void readAndSplitScriptContainingCommentsWithWindowsLineEnding () throws Exception {
137
+ String script = readScript ("test-data-with-comments.sql" ).replaceAll ("\n " , "\r \n " );
138
+ List <String > statements = new ArrayList <>();
139
+ splitSqlScript (script , ';' , statements );
140
+
141
+ String statement1 = "insert into customer (id, name) values (1, 'Rod; Johnson'), (2, 'Adrian Collier')" ;
142
+ String statement2 = "insert into orders(id, order_date, customer_id) values (1, '2008-01-02', 2)" ;
143
+ String statement3 = "insert into orders(id, order_date, customer_id) values (1, '2008-01-02', 2)" ;
144
+ // Statement 4 addresses the error described in SPR-9982.
145
+ String statement4 = "INSERT INTO persons( person_id , name) VALUES( 1 , 'Name' )" ;
146
+
147
+ assertEquals ("wrong number of statements" , 4 , statements .size ());
148
+ assertEquals ("statement 1 not split correctly" , statement1 , statements .get (0 ));
149
+ assertEquals ("statement 2 not split correctly" , statement2 , statements .get (1 ));
150
+ assertEquals ("statement 3 not split correctly" , statement3 , statements .get (2 ));
151
+ assertEquals ("statement 4 not split correctly" , statement4 , statements .get (3 ));
152
+ }
153
+
135
154
@ Test // SPR-10330
136
155
public void readAndSplitScriptContainingCommentsWithLeadingTabs () throws Exception {
137
156
String script = readScript ("test-data-with-comments-and-leading-tabs.sql" );
0 commit comments