diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-12-30 14:20:35 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2022-01-01 18:58:30 +0300 |
| commit | 5ca83a5fb3a2f092a63e452e1bf808f1ad445b05 (patch) | |
| tree | b6b2298105bb225e160a2733b6c18f864548b7cf /crates/parser/src | |
| parent | 3d63abf1d868218613f33dc59968d3671f7f14a8 (diff) | |
| download | rust-5ca83a5fb3a2f092a63e452e1bf808f1ad445b05.tar.gz rust-5ca83a5fb3a2f092a63e452e1bf808f1ad445b05.zip | |
internal: add tests for patterns
Diffstat (limited to 'crates/parser/src')
| -rw-r--r-- | crates/parser/src/tests/entries.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/parser/src/tests/entries.rs b/crates/parser/src/tests/entries.rs index 947922d8b32..18d9ece2a2c 100644 --- a/crates/parser/src/tests/entries.rs +++ b/crates/parser/src/tests/entries.rs @@ -21,12 +21,22 @@ fn stmt() { check_prefix(PrefixEntryPoint::Stmt, "92; fn", "92"); check_prefix(PrefixEntryPoint::Stmt, "let _ = 92; 1", "let _ = 92"); check_prefix(PrefixEntryPoint::Stmt, "pub fn f() {} = 92", "pub fn f() {}"); + check_prefix(PrefixEntryPoint::Stmt, "struct S;;", "struct S;"); + check_prefix(PrefixEntryPoint::Stmt, "fn f() {};", "fn f() {}"); check_prefix(PrefixEntryPoint::Stmt, ";;;", ";"); check_prefix(PrefixEntryPoint::Stmt, "+", "+"); check_prefix(PrefixEntryPoint::Stmt, "@", "@"); check_prefix(PrefixEntryPoint::Stmt, "loop {} - 1", "loop {}"); } +#[test] +fn pat() { + check_prefix(PrefixEntryPoint::Pat, "x y", "x"); + check_prefix(PrefixEntryPoint::Pat, "fn f() {}", "fn"); + // FIXME: this one is wrong + check_prefix(PrefixEntryPoint::Pat, ".. ..", ".. .."); +} + fn check_prefix(entry: PrefixEntryPoint, input: &str, prefix: &str) { let lexed = LexedStr::new(input); let input = lexed.to_input(); |
