@@ -22,7 +22,7 @@ use test_utils::*;
22
22
use sqlparser:: ast:: SelectItem :: UnnamedExpr ;
23
23
use sqlparser:: ast:: * ;
24
24
use sqlparser:: dialect:: { GenericDialect , SQLiteDialect } ;
25
- use sqlparser:: parser:: ParserOptions ;
25
+ use sqlparser:: parser:: { ParserError , ParserOptions } ;
26
26
use sqlparser:: tokenizer:: Token ;
27
27
28
28
#[ test]
@@ -433,12 +433,31 @@ fn invalid_empty_list() {
433
433
434
434
#[ test]
435
435
fn parse_start_transaction_with_modifier ( ) {
436
- sqlite_and_generic ( ) . verified_stmt ( "BEGIN DEFERRED TRANSACTION" ) ;
437
- sqlite_and_generic ( ) . verified_stmt ( "BEGIN IMMEDIATE TRANSACTION" ) ;
438
- sqlite_and_generic ( ) . verified_stmt ( "BEGIN EXCLUSIVE TRANSACTION" ) ;
439
- sqlite_and_generic ( ) . one_statement_parses_to ( "BEGIN DEFERRED" , "BEGIN DEFERRED TRANSACTION" ) ;
440
- sqlite_and_generic ( ) . one_statement_parses_to ( "BEGIN IMMEDIATE" , "BEGIN IMMEDIATE TRANSACTION" ) ;
441
- sqlite_and_generic ( ) . one_statement_parses_to ( "BEGIN EXCLUSIVE" , "BEGIN EXCLUSIVE TRANSACTION" ) ;
436
+ let ( supported_dialects, unsupported_dialects) =
437
+ partition_all_dialects_by_inclusion ( vec ! [ "generic" , "sqlite" ] ) ;
438
+
439
+ supported_dialects. verified_stmt ( "BEGIN DEFERRED TRANSACTION" ) ;
440
+ supported_dialects. verified_stmt ( "BEGIN IMMEDIATE TRANSACTION" ) ;
441
+ supported_dialects. verified_stmt ( "BEGIN EXCLUSIVE TRANSACTION" ) ;
442
+ supported_dialects. one_statement_parses_to ( "BEGIN DEFERRED" , "BEGIN DEFERRED TRANSACTION" ) ;
443
+ supported_dialects. one_statement_parses_to ( "BEGIN IMMEDIATE" , "BEGIN IMMEDIATE TRANSACTION" ) ;
444
+ supported_dialects. one_statement_parses_to ( "BEGIN EXCLUSIVE" , "BEGIN EXCLUSIVE TRANSACTION" ) ;
445
+
446
+ let res = unsupported_dialects. parse_sql_statements ( "BEGIN DEFERRED" ) ;
447
+ assert_eq ! (
448
+ ParserError :: ParserError ( "Expected end of statement, found: DEFERRED" . to_string( ) ) ,
449
+ res. unwrap_err( ) ,
450
+ ) ;
451
+ let res = unsupported_dialects. parse_sql_statements ( "BEGIN IMMEDIATE" ) ;
452
+ assert_eq ! (
453
+ ParserError :: ParserError ( "Expected end of statement, found: IMMEDIATE" . to_string( ) ) ,
454
+ res. unwrap_err( ) ,
455
+ ) ;
456
+ let res = unsupported_dialects. parse_sql_statements ( "BEGIN EXCLUSIVE" ) ;
457
+ assert_eq ! (
458
+ ParserError :: ParserError ( "Expected end of statement, found: EXCLUSIVE" . to_string( ) ) ,
459
+ res. unwrap_err( ) ,
460
+ ) ;
442
461
}
443
462
444
463
fn sqlite ( ) -> TestedDialects {
0 commit comments