HHH-14193 MultipleLinesSqlCommandExtractor should tolerate empty input scripts
This commit is contained in:
parent
b9fcc63d84
commit
59d40c3bf5
|
@ -57,7 +57,7 @@ options {
|
|||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
script
|
||||
: (newLineToSkip)* (statement)+ EOF
|
||||
: (newLineToSkip)* (statement)* EOF
|
||||
;
|
||||
|
||||
statement
|
||||
|
@ -141,7 +141,7 @@ LINE_COMMENT
|
|||
;
|
||||
|
||||
/**
|
||||
* Note : this comes from the great Terrance Parr (author of Antlr) -
|
||||
* Note : this comes from the great Terence Parr (author of Antlr) -
|
||||
*
|
||||
* https://theantlrguy.atlassian.net/wiki/spaces/ANTLR3/pages/2687360/How+do+I+match+multi-line+comments
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.test.fileimport;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
|
||||
import org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor;
|
||||
|
||||
|
@ -58,4 +59,13 @@ public class MultiLineImportExtractorTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractionFromEmptyScript() throws IOException {
|
||||
StringReader reader = new StringReader( "" );
|
||||
final String[] commands = extractor.extractCommands( reader );
|
||||
assertThat( commands, notNullValue() );
|
||||
assertThat( commands.length, is( 0 ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue