| 3905 | |
| 3906 | #[test] |
| 3907 | fn test_try_statement() { |
| 3908 | for test_case in &[ |
| 3909 | "try: |
| 3910 | pass |
| 3911 | except: |
| 3912 | pass", |
| 3913 | "try: |
| 3914 | pass |
| 3915 | except Exception: |
| 3916 | pass", |
| 3917 | "try: |
| 3918 | pass |
| 3919 | except Exception as e: |
| 3920 | pass", |
| 3921 | "try: |
| 3922 | pass |
| 3923 | except Exception as e: |
| 3924 | pass |
| 3925 | else: |
| 3926 | pass", |
| 3927 | "try: |
| 3928 | pass |
| 3929 | except Exception as e: |
| 3930 | pass |
| 3931 | else: |
| 3932 | pass |
| 3933 | finally: |
| 3934 | pass", |
| 3935 | "try: |
| 3936 | pass |
| 3937 | except *Exception as e: |
| 3938 | pass |
| 3939 | ", |
| 3940 | ] { |
| 3941 | let mut parser = Parser::new(test_case); |
| 3942 | let program = parser.parse().expect("parsing failed"); |
| 3943 | |
| 3944 | insta::with_settings!({ |
| 3945 | description => test_case.to_string(), // the template source code |
| 3946 | snapshot_path => "../../test_data/output/", |
| 3947 | omit_expression => true // do not include the default expression |
| 3948 | }, { |
| 3949 | assert_debug_snapshot!(program); |
| 3950 | }); |
| 3951 | } |
| 3952 | } |
| 3953 | |
| 3954 | #[test] |
| 3955 | fn test_ellipsis_statement() { |