@@ -634,73 +634,77 @@ mod order_by_clause_tests {
634
634
}
635
635
}
636
636
637
- // #[cfg(test)]
638
- // mod test_select_limit_clause {
639
- // use super::test_utils::select_statement_with_limit_clause ;
640
- // use crate::expression::test_utils::{binary_op_expression, numeric_literal_expression };
641
- // use crate::parser::test_utils::*;
642
- // use crate::{BinaryOp, LimitClause, Statement};
637
+ #[ cfg( test) ]
638
+ mod limit_clause_tests {
639
+ use super :: test_utils:: select_stmt ;
640
+ use crate :: expression:: test_utils:: { binary_op , numeric_expr } ;
641
+ use crate :: parser:: test_utils:: * ;
642
+ use crate :: { BinaryOp , LimitClause , Statement } ;
643
643
644
- // #[test]
645
- // fn test_select_limit_clause_basic() {
646
- // let expected_statement = select_statement_with_limit_clause(LimitClause {
647
- // limit: Box::new(numeric_literal_expression("1")),
648
- // offset: None,
649
- // additional_limit: None,
650
- // });
644
+ #[ test]
645
+ fn limit_clause ( ) {
646
+ let mut expected_statement = select_stmt ( ) ;
647
+ expected_statement. limit = Some ( LimitClause {
648
+ limit : Box :: new ( numeric_expr ( "1" ) ) ,
649
+ offset : None ,
650
+ additional_limit : None ,
651
+ } ) ;
651
652
652
- // run_sunny_day_test(
653
- // "SELECT * FROM table_1 LIMIT 1",
654
- // Statement::Select(expected_statement),
655
- // );
656
- // }
653
+ run_sunny_day_test (
654
+ "SELECT * FROM table_name1 LIMIT 1" ,
655
+ Statement :: Select ( expected_statement) ,
656
+ ) ;
657
+ }
657
658
658
- // #[test]
659
- // fn test_select_limit_clause_basic_expression() {
660
- // let expected_statement = select_statement_with_limit_clause(LimitClause {
661
- // limit: Box::new(binary_op_expression(
662
- // BinaryOp::Plus,
663
- // numeric_literal_expression("1"),
664
- // numeric_literal_expression("2"),
665
- // )),
666
- // offset: None,
667
- // additional_limit: None,
668
- // });
659
+ #[ test]
660
+ fn limit_clause_basic_expression ( ) {
661
+ let mut expected_statement = select_stmt ( ) ;
662
+ expected_statement. limit = Some ( LimitClause {
663
+ limit : Box :: new ( binary_op (
664
+ BinaryOp :: Plus ,
665
+ numeric_expr ( "1" ) ,
666
+ numeric_expr ( "2" ) ,
667
+ ) ) ,
668
+ offset : None ,
669
+ additional_limit : None ,
670
+ } ) ;
669
671
670
- // run_sunny_day_test(
671
- // "SELECT * FROM table_1 LIMIT 1 + 2",
672
- // Statement::Select(expected_statement),
673
- // );
674
- // }
672
+ run_sunny_day_test (
673
+ "SELECT * FROM table_name1 LIMIT 1 + 2" ,
674
+ Statement :: Select ( expected_statement) ,
675
+ ) ;
676
+ }
675
677
676
- // #[test]
677
- // fn test_select_limit_clause_with_offset() {
678
- // let expected_statement = select_statement_with_limit_clause(LimitClause {
679
- // limit: Box::new(numeric_literal_expression("1")),
680
- // offset: Some(Box::new(numeric_literal_expression("2"))),
681
- // additional_limit: None,
682
- // });
678
+ #[ test]
679
+ fn limit_clause_with_offset ( ) {
680
+ let mut expected_statement = select_stmt ( ) ;
681
+ expected_statement. limit = Some ( LimitClause {
682
+ limit : Box :: new ( numeric_expr ( "1" ) ) ,
683
+ offset : Some ( Box :: new ( numeric_expr ( "2" ) ) ) ,
684
+ additional_limit : None ,
685
+ } ) ;
683
686
684
- // run_sunny_day_test(
685
- // "SELECT * FROM table_1 LIMIT 1 OFFSET 2",
686
- // Statement::Select(expected_statement),
687
- // );
688
- // }
687
+ run_sunny_day_test (
688
+ "SELECT * FROM table_name1 LIMIT 1 OFFSET 2" ,
689
+ Statement :: Select ( expected_statement) ,
690
+ ) ;
691
+ }
689
692
690
- // #[test]
691
- // fn test_select_limit_clause_with_additional_limit() {
692
- // let expected_statement = select_statement_with_limit_clause(LimitClause {
693
- // limit: Box::new(numeric_literal_expression("1")),
694
- // offset: None,
695
- // additional_limit: Some(Box::new(numeric_literal_expression("2"))),
696
- // });
693
+ #[ test]
694
+ fn limit_clause_with_additional_limit ( ) {
695
+ let mut expected_statement = select_stmt ( ) ;
696
+ expected_statement. limit = Some ( LimitClause {
697
+ limit : Box :: new ( numeric_expr ( "1" ) ) ,
698
+ offset : None ,
699
+ additional_limit : Some ( Box :: new ( numeric_expr ( "2" ) ) ) ,
700
+ } ) ;
697
701
698
- // run_sunny_day_test(
699
- // "SELECT * FROM table_1 LIMIT 1, 2",
700
- // Statement::Select(expected_statement),
701
- // );
702
- // }
703
- // }
702
+ run_sunny_day_test (
703
+ "SELECT * FROM table_name1 LIMIT 1, 2" ,
704
+ Statement :: Select ( expected_statement) ,
705
+ ) ;
706
+ }
707
+ }
704
708
705
709
// #[cfg(test)]
706
710
// mod test_select_with_cte {
0 commit comments