| 3880 | |
| 3881 | #[test] |
| 3882 | fn test_while_statement() { |
| 3883 | for test_case in &[ |
| 3884 | "while a: pass", |
| 3885 | "while a: |
| 3886 | pass", |
| 3887 | "while a: |
| 3888 | a = 1 |
| 3889 | else: |
| 3890 | b = 1 |
| 3891 | ", |
| 3892 | ] { |
| 3893 | let mut parser = Parser::new(test_case); |
| 3894 | let program = parser.parse().expect("parsing failed"); |
| 3895 | |
| 3896 | insta::with_settings!({ |
| 3897 | description => test_case.to_string(), // the template source code |
| 3898 | snapshot_path => "../../test_data/output/", |
| 3899 | omit_expression => true // do not include the default expression |
| 3900 | }, { |
| 3901 | assert_debug_snapshot!(program); |
| 3902 | }); |
| 3903 | } |
| 3904 | } |
| 3905 | |
| 3906 | #[test] |
| 3907 | fn test_try_statement() { |