From 138514bea244253f2c0007976921f4475c9d2cd5 Mon Sep 17 00:00:00 2001 From: Daiki Ihara Date: Thu, 14 Jan 2021 00:02:03 +0900 Subject: Add test for yield_expr --- .../parser/inline/ok/0159_yield_expr.rast | 28 ++++++++++++++++++++++ .../test_data/parser/inline/ok/0159_yield_expr.rs | 4 ++++ 2 files changed, 32 insertions(+) create mode 100644 crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rs (limited to 'crates/syntax/test_data') diff --git a/crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rast b/crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rast new file mode 100644 index 000000000..05fc90743 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rast @@ -0,0 +1,28 @@ +SOURCE_FILE@0..37 + FN@0..36 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + WHITESPACE@8..9 " " + BLOCK_EXPR@9..36 + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + EXPR_STMT@15..21 + YIELD_EXPR@15..20 + YIELD_KW@15..20 "yield" + SEMICOLON@20..21 ";" + WHITESPACE@21..26 "\n " + EXPR_STMT@26..34 + YIELD_EXPR@26..33 + YIELD_KW@26..31 "yield" + WHITESPACE@31..32 " " + LITERAL@32..33 + INT_NUMBER@32..33 "1" + SEMICOLON@33..34 ";" + WHITESPACE@34..35 "\n" + R_CURLY@35..36 "}" + WHITESPACE@36..37 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rs b/crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rs new file mode 100644 index 000000000..596e221f7 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0159_yield_expr.rs @@ -0,0 +1,4 @@ +fn foo() { + yield; + yield 1; +} -- cgit v1.2.3