about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Bushart <jonas@bushart.org>2022-04-03 12:01:11 +0000
committerGitHub <noreply@github.com>2022-04-03 12:01:11 +0000
commit0cc079f3e96968cdd88cb016ab34c22ed5f93dc6 (patch)
tree7f27528a36c38eef0bf23371db244c30e14581a6
parentc039810b16c15c0d94eb57022130db4d0142918f (diff)
downloadrust-0cc079f3e96968cdd88cb016ab34c22ed5f93dc6.tar.gz
rust-0cc079f3e96968cdd88cb016ab34c22ed5f93dc6.zip
Merge test functions using the same coverage marks to avoid parallelism
-rw-r--r--crates/ide_db/src/imports/insert_use/tests.rs162
1 files changed, 84 insertions, 78 deletions
diff --git a/crates/ide_db/src/imports/insert_use/tests.rs b/crates/ide_db/src/imports/insert_use/tests.rs
index 39d2b22ff03..2048b7baede 100644
--- a/crates/ide_db/src/imports/insert_use/tests.rs
+++ b/crates/ide_db/src/imports/insert_use/tests.rs
@@ -85,63 +85,6 @@ use external_crate2::bar::A;",
 }
 
 #[test]
-fn insert_not_group_empty() {
-    cov_mark::check!(insert_empty_file);
-    check_with_config(
-        "use external_crate2::bar::A",
-        r"",
-        r"use external_crate2::bar::A;
-
-",
-        &InsertUseConfig {
-            granularity: ImportGranularity::Item,
-            enforce_granularity: true,
-            prefix_kind: PrefixKind::Plain,
-            group: false,
-            skip_glob_imports: true,
-        },
-    );
-}
-
-#[test]
-fn insert_not_group_empty_module() {
-    cov_mark::check!(insert_empty_module);
-    check_with_config(
-        "foo::bar",
-        r"mod x {$0}",
-        r"mod x {
-    use foo::bar;
-}",
-        &InsertUseConfig {
-            granularity: ImportGranularity::Item,
-            enforce_granularity: true,
-            prefix_kind: PrefixKind::Plain,
-            group: false,
-            skip_glob_imports: true,
-        },
-    );
-}
-
-#[test]
-fn insert_no_group_after_inner_attr() {
-    cov_mark::check!(insert_empty_inner_attr);
-    check_with_config(
-        "foo::bar",
-        r"#![allow(unused_imports)]",
-        r"#![allow(unused_imports)]
-
-use foo::bar;",
-        &InsertUseConfig {
-            granularity: ImportGranularity::Item,
-            enforce_granularity: true,
-            prefix_kind: PrefixKind::Plain,
-            group: false,
-            skip_glob_imports: true,
-        },
-    )
-}
-
-#[test]
 fn insert_existing() {
     check_crate("std::fs", "use std::fs;", "use std::fs;")
 }
@@ -359,45 +302,108 @@ fn main() {}",
 
 #[test]
 fn insert_empty_file() {
-    cov_mark::check!(insert_empty_file);
-    // empty files will get two trailing newlines
-    // this is due to the test case insert_no_imports above
-    check_crate(
-        "foo::bar",
-        "",
-        r"use foo::bar;
+    {
+        // Default configuration
+        cov_mark::check!(insert_empty_file);
+        // empty files will get two trailing newlines
+        // this is due to the test case insert_no_imports above
+        check_crate(
+            "foo::bar",
+            "",
+            r"use foo::bar;
 
 ",
-    )
+        );
+    }
+    {
+        // "not group" configuration
+        cov_mark::check!(insert_empty_file);
+        check_with_config(
+            "use external_crate2::bar::A",
+            r"",
+            r"use external_crate2::bar::A;
+
+",
+            &InsertUseConfig {
+                granularity: ImportGranularity::Item,
+                enforce_granularity: true,
+                prefix_kind: PrefixKind::Plain,
+                group: false,
+                skip_glob_imports: true,
+            },
+        );
+    }
 }
 
 #[test]
 fn insert_empty_module() {
-    cov_mark::check!(insert_empty_module);
-    check(
-        "foo::bar",
-        r"
+    {
+        // Default configuration
+        cov_mark::check!(insert_empty_module);
+        check(
+            "foo::bar",
+            r"
 mod x {$0}
 ",
-        r"
+            r"
 mod x {
     use foo::bar;
 }
 ",
-        ImportGranularity::Item,
-    )
+            ImportGranularity::Item,
+        );
+    }
+    {
+        // "not group" configuration
+        cov_mark::check!(insert_empty_module);
+        check_with_config(
+            "foo::bar",
+            r"mod x {$0}",
+            r"mod x {
+    use foo::bar;
+}",
+            &InsertUseConfig {
+                granularity: ImportGranularity::Item,
+                enforce_granularity: true,
+                prefix_kind: PrefixKind::Plain,
+                group: false,
+                skip_glob_imports: true,
+            },
+        );
+    }
 }
 
 #[test]
 fn insert_after_inner_attr() {
-    cov_mark::check!(insert_empty_inner_attr);
-    check_crate(
-        "foo::bar",
-        r"#![allow(unused_imports)]",
-        r"#![allow(unused_imports)]
+    {
+        // Default configuration
+        cov_mark::check!(insert_empty_inner_attr);
+        check_crate(
+            "foo::bar",
+            r"#![allow(unused_imports)]",
+            r"#![allow(unused_imports)]
 
 use foo::bar;",
-    )
+        );
+    }
+    {
+        // "not group" configuration
+        cov_mark::check!(insert_empty_inner_attr);
+        check_with_config(
+            "foo::bar",
+            r"#![allow(unused_imports)]",
+            r"#![allow(unused_imports)]
+
+use foo::bar;",
+            &InsertUseConfig {
+                granularity: ImportGranularity::Item,
+                enforce_granularity: true,
+                prefix_kind: PrefixKind::Plain,
+                group: false,
+                skip_glob_imports: true,
+            },
+        );
+    }
 }
 
 #[test]