Skip to content

Commit d4207e2

Browse files
committed
Add test_generator_expression_argument
1 parent 65a62b8 commit d4207e2

File tree

3 files changed

+347
-0
lines changed

3 files changed

+347
-0
lines changed

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"bindgen",
3131
"cstring",
3232
"chrono",
33+
"insta",
3334
"peekable",
3435
"lalrpop",
3536
"memmap",

compiler/parser/src/parser.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,19 @@ with (0 as a, 1 as b,): pass
310310
}
311311
}
312312

313+
#[test]
314+
fn test_generator_expression_argument() {
315+
let source = r#"' '.join(
316+
sql
317+
for sql in (
318+
"LIMIT %d" % limit if limit else None,
319+
("OFFSET %d" % offset) if offset else None,
320+
)
321+
)"#;
322+
let parse_ast = parse_expression(source, "<test>").unwrap();
323+
insta::assert_debug_snapshot!(parse_ast);
324+
}
325+
313326
#[test]
314327
fn test_dict_unpacking() {
315328
let parse_ast = parse_expression(r#"{"a": "b", **c, "d": "e"}"#, "<test>").unwrap();

compiler/parser/src/snapshots/rustpython_parser__parser__tests__generator_expression_argument.snap

Lines changed: 333 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)