about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2022-01-02 18:50:32 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2022-01-02 18:50:32 +0300
commit2e34a5e2e997c7478a6b97897c6c603a50ed5f39 (patch)
treee2563bd075d9d05f1c80ae8875f58369e4e276ab
parentc72908a201c066370d7dccc09623787281428089 (diff)
downloadrust-2e34a5e2e997c7478a6b97897c6c603a50ed5f39.tar.gz
rust-2e34a5e2e997c7478a6b97897c6c603a50ed5f39.zip
add empty input tests
-rw-r--r--crates/parser/src/tests/top_entries.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/crates/parser/src/tests/top_entries.rs b/crates/parser/src/tests/top_entries.rs
index 0ba22cf2411..24e41b46f8e 100644
--- a/crates/parser/src/tests/top_entries.rs
+++ b/crates/parser/src/tests/top_entries.rs
@@ -53,6 +53,13 @@ fn source_file() {
 fn macro_stmt() {
     check(
         TopEntryPoint::MacroStmts,
+        "",
+        expect![[r#"
+            MACRO_STMTS
+        "#]],
+    );
+    check(
+        TopEntryPoint::MacroStmts,
         "#!/usr/bin/rust",
         expect![[r##"
             MACRO_STMTS
@@ -96,6 +103,13 @@ fn macro_stmt() {
 fn macro_items() {
     check(
         TopEntryPoint::MacroItems,
+        "",
+        expect![[r#"
+            MACRO_ITEMS
+        "#]],
+    );
+    check(
+        TopEntryPoint::MacroItems,
         "#!/usr/bin/rust",
         expect![[r##"
             MACRO_ITEMS
@@ -133,6 +147,14 @@ fn macro_items() {
 fn macro_pattern() {
     check(
         TopEntryPoint::Pattern,
+        "",
+        expect![[r#"
+            ERROR
+            error 0: expected pattern
+        "#]],
+    );
+    check(
+        TopEntryPoint::Pattern,
         "Some(_)",
         expect![[r#"
             TUPLE_STRUCT_PAT
@@ -179,6 +201,15 @@ fn macro_pattern() {
 fn type_() {
     check(
         TopEntryPoint::Type,
+        "",
+        expect![[r#"
+            ERROR
+            error 0: expected type
+        "#]],
+    );
+
+    check(
+        TopEntryPoint::Type,
         "Option<!>",
         expect![[r#"
             PATH_TYPE
@@ -228,6 +259,14 @@ fn type_() {
 fn expr() {
     check(
         TopEntryPoint::Expr,
+        "",
+        expect![[r#"
+            ERROR
+            error 0: expected expression
+        "#]],
+    );
+    check(
+        TopEntryPoint::Expr,
         "2 + 2 == 5",
         expect![[r#"
         BIN_EXPR