mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
⬆️ insta
This commit is contained in:
parent
5a99184967
commit
0f6c048ce1
26 changed files with 1446 additions and 1486 deletions
|
@ -68,7 +68,7 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn do_ref_completion(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Reference)
|
||||
|
@ -76,7 +76,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_struct_field_completion() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A { the_field: u32 }
|
||||
|
@ -102,7 +102,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_struct_field_completion_self() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A {
|
||||
|
@ -144,7 +144,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_struct_field_completion_autoderef() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A { the_field: (u32, i32) }
|
||||
|
@ -180,7 +180,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_no_struct_field_completion_for_method_call() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A { the_field: u32 }
|
||||
|
@ -195,7 +195,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_method_completion() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A {}
|
||||
|
@ -224,7 +224,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_trait_method_completion() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A {}
|
||||
|
@ -252,7 +252,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_trait_method_completion_deduplicated() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A {}
|
||||
|
@ -280,7 +280,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_no_non_self_method() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A {}
|
||||
|
@ -298,7 +298,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_method_attr_filtering() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A {}
|
||||
|
@ -331,7 +331,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_tuple_field_completion() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
fn foo() {
|
||||
|
@ -365,7 +365,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_tuple_field_inference() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
pub struct S;
|
||||
|
@ -400,7 +400,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_completion_works_in_consts() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A { the_field: u32 }
|
||||
|
@ -426,7 +426,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_completion_await_impls_future() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_completion(
|
||||
r###"
|
||||
//- /main.rs
|
||||
|
|
|
@ -51,7 +51,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn do_magic_completion(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Magic)
|
||||
|
@ -59,7 +59,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_param_completion_last_param() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_magic_completion(
|
||||
r"
|
||||
fn foo(file_id: FileId) {}
|
||||
|
@ -83,7 +83,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_param_completion_nth_param() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_magic_completion(
|
||||
r"
|
||||
fn foo(file_id: FileId) {}
|
||||
|
@ -107,7 +107,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_param_completion_trait_param() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_magic_completion(
|
||||
r"
|
||||
pub(crate) trait SourceRoot {
|
||||
|
|
|
@ -113,7 +113,7 @@ fn complete_return(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn do_keyword_completion(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Keyword)
|
||||
|
@ -121,7 +121,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_keywords_in_use_stmt() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
use <|>
|
||||
|
@ -152,7 +152,7 @@ mod tests {
|
|||
]"###
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
use a::<|>
|
||||
|
@ -176,7 +176,7 @@ mod tests {
|
|||
]"###
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
use a::{b, <|>}
|
||||
|
@ -203,7 +203,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_various_keywords_in_function() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() {
|
||||
|
@ -253,7 +253,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_else_after_if() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() {
|
||||
|
@ -319,7 +319,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_completion_return_value() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() -> i32 {
|
||||
|
@ -366,7 +366,7 @@ mod tests {
|
|||
},
|
||||
]"###
|
||||
);
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() {
|
||||
|
@ -417,7 +417,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn dont_add_semi_after_return_if_not_a_statement() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() -> i32 {
|
||||
|
@ -469,7 +469,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn last_return_in_block_has_semi() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() -> i32 {
|
||||
|
@ -517,7 +517,7 @@ mod tests {
|
|||
},
|
||||
]"###
|
||||
);
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() -> i32 {
|
||||
|
@ -571,7 +571,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_break_and_continue_in_loops() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() -> i32 {
|
||||
|
@ -633,7 +633,7 @@ mod tests {
|
|||
);
|
||||
|
||||
// No completion: lambda isolates control flow
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn quux() -> i32 {
|
||||
|
@ -683,7 +683,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn no_semi_after_break_continue_in_expr() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_keyword_completion(
|
||||
r"
|
||||
fn f() {
|
||||
|
|
|
@ -79,7 +79,7 @@ mod tests {
|
|||
use test_utils::covers;
|
||||
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn do_reference_completion(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Reference)
|
||||
|
@ -120,7 +120,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_mod_with_docs() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
use self::my<|>;
|
||||
|
@ -149,7 +149,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_use_item_starting_with_self() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
use self::m::<|>;
|
||||
|
@ -173,7 +173,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_use_item_starting_with_crate() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -204,7 +204,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_nested_use_tree() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -235,7 +235,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_deeply_nested_use_tree() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -263,7 +263,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_enum_variant() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -306,7 +306,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_enum_variant_with_details() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -363,7 +363,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_struct_associated_method() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -396,7 +396,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_struct_associated_const() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -429,7 +429,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_struct_associated_type() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -462,7 +462,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_enum_associated_method() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -495,7 +495,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_union_associated_method() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -528,7 +528,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_use_paths_across_crates() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /main.rs
|
||||
|
@ -554,7 +554,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_type_alias() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
struct S;
|
||||
|
|
|
@ -28,7 +28,7 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn complete(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Reference)
|
||||
|
@ -53,7 +53,7 @@ mod tests {
|
|||
}
|
||||
",
|
||||
);
|
||||
assert_debug_snapshot_matches!(completions, @r###"
|
||||
assert_debug_snapshot!(completions, @r###"
|
||||
⋮[
|
||||
⋮ CompletionItem {
|
||||
⋮ label: "E",
|
||||
|
|
|
@ -72,7 +72,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn do_postfix_completion(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Postfix)
|
||||
|
@ -80,7 +80,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn postfix_completion_works_for_trivial_path_expression() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_postfix_completion(
|
||||
r#"
|
||||
fn main() {
|
||||
|
@ -152,7 +152,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn some_postfix_completions_ignored() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_postfix_completion(
|
||||
r#"
|
||||
fn main() {
|
||||
|
|
|
@ -23,7 +23,7 @@ pub(super) fn complete_record_literal(acc: &mut Completions, ctx: &CompletionCon
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn complete(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Reference)
|
||||
|
@ -39,7 +39,7 @@ mod tests {
|
|||
}
|
||||
",
|
||||
);
|
||||
assert_debug_snapshot_matches!(completions, @r###"
|
||||
assert_debug_snapshot!(completions, @r###"
|
||||
⋮[
|
||||
⋮ CompletionItem {
|
||||
⋮ label: "the_field",
|
||||
|
@ -65,7 +65,7 @@ mod tests {
|
|||
}
|
||||
",
|
||||
);
|
||||
assert_debug_snapshot_matches!(completions, @r###"
|
||||
assert_debug_snapshot!(completions, @r###"
|
||||
⋮[
|
||||
⋮ CompletionItem {
|
||||
⋮ label: "a",
|
||||
|
@ -91,7 +91,7 @@ mod tests {
|
|||
}
|
||||
",
|
||||
);
|
||||
assert_debug_snapshot_matches!(completions, @r###"
|
||||
assert_debug_snapshot!(completions, @r###"
|
||||
⋮[
|
||||
⋮ CompletionItem {
|
||||
⋮ label: "b",
|
||||
|
@ -116,7 +116,7 @@ mod tests {
|
|||
}
|
||||
",
|
||||
);
|
||||
assert_debug_snapshot_matches!(completions, @r###"
|
||||
assert_debug_snapshot!(completions, @r###"
|
||||
⋮[
|
||||
⋮ CompletionItem {
|
||||
⋮ label: "a",
|
||||
|
|
|
@ -22,7 +22,7 @@ pub(super) fn complete_record_pattern(acc: &mut Completions, ctx: &CompletionCon
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn complete(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Reference)
|
||||
|
@ -41,7 +41,7 @@ mod tests {
|
|||
}
|
||||
",
|
||||
);
|
||||
assert_debug_snapshot_matches!(completions, @r###"
|
||||
assert_debug_snapshot!(completions, @r###"
|
||||
⋮[
|
||||
⋮ CompletionItem {
|
||||
⋮ label: "foo",
|
||||
|
@ -70,7 +70,7 @@ mod tests {
|
|||
}
|
||||
",
|
||||
);
|
||||
assert_debug_snapshot_matches!(completions, @r###"
|
||||
assert_debug_snapshot!(completions, @r###"
|
||||
⋮[
|
||||
⋮ CompletionItem {
|
||||
⋮ label: "bar",
|
||||
|
|
|
@ -122,7 +122,7 @@ impl ImportResolver {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn do_reference_completion(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Reference)
|
||||
|
@ -130,7 +130,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_bindings_from_let() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
fn quux(x: i32) {
|
||||
|
@ -171,7 +171,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_bindings_from_if_let() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
fn quux() {
|
||||
|
@ -215,7 +215,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_bindings_from_for() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
fn quux() {
|
||||
|
@ -247,7 +247,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_generic_params() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
fn quux<T>() {
|
||||
|
@ -277,7 +277,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_generic_params_in_struct() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
struct X<T> {
|
||||
|
@ -306,7 +306,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_module_items() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
struct Foo;
|
||||
|
@ -345,7 +345,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_extern_prelude() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
//- /lib.rs
|
||||
|
@ -369,7 +369,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_module_items_in_nested_modules() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
struct Foo;
|
||||
|
@ -401,7 +401,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_return_type() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
struct Foo;
|
||||
|
@ -430,7 +430,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn dont_show_both_completions_for_shadowing() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
fn foo() {
|
||||
|
@ -465,7 +465,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_self_in_methods() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(r"impl S { fn foo(&self) { <|> } }"),
|
||||
@r#"[
|
||||
CompletionItem {
|
||||
|
@ -489,7 +489,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_prelude() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /main.rs
|
||||
|
|
|
@ -40,7 +40,7 @@ fn ${1:feature}() {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn do_snippet_completion(code: &str) -> Vec<CompletionItem> {
|
||||
do_completion(code, CompletionKind::Snippet)
|
||||
|
@ -48,7 +48,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_snippets_in_expressions() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_snippet_completion(r"fn foo(x: i32) { <|> }"),
|
||||
@r#"[
|
||||
CompletionItem {
|
||||
|
@ -71,11 +71,11 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn should_not_complete_snippets_in_path() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"),
|
||||
@r#"[]"#
|
||||
);
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_snippet_completion(r"fn foo(x: i32) { ::<|> }"),
|
||||
@r#"[]"#
|
||||
);
|
||||
|
@ -83,7 +83,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn completes_snippets_in_items() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_snippet_completion(
|
||||
r"
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -186,7 +186,7 @@ impl Completions {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{do_completion, CompletionItem, CompletionKind};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
use test_utils::covers;
|
||||
|
||||
fn do_reference_completion(code: &str) -> Vec<CompletionItem> {
|
||||
|
@ -196,7 +196,7 @@ mod tests {
|
|||
#[test]
|
||||
fn inserts_parens_for_function_calls() {
|
||||
covers!(inserts_parens_for_function_calls);
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
fn no_args() {}
|
||||
|
@ -222,7 +222,7 @@ mod tests {
|
|||
},
|
||||
]"###
|
||||
);
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
fn with_args(x: i32, y: String) {}
|
||||
|
@ -248,7 +248,7 @@ mod tests {
|
|||
},
|
||||
]"###
|
||||
);
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
r"
|
||||
struct S {}
|
||||
|
@ -275,7 +275,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn dont_render_function_parens_in_use_item() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -298,7 +298,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn dont_render_function_parens_if_already_call() {
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
@ -327,7 +327,7 @@ mod tests {
|
|||
},
|
||||
]"#
|
||||
);
|
||||
assert_debug_snapshot_matches!(
|
||||
assert_debug_snapshot!(
|
||||
do_reference_completion(
|
||||
"
|
||||
//- /lib.rs
|
||||
|
|
|
@ -183,7 +183,7 @@ fn check_struct_shorthand_initialization(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
use join_to_string::join;
|
||||
use ra_syntax::SourceFile;
|
||||
use test_utils::assert_eq_text;
|
||||
|
@ -519,7 +519,7 @@ mod tests {
|
|||
fn test_unresolved_module_diagnostic() {
|
||||
let (analysis, file_id) = single_file("mod foo;");
|
||||
let diagnostics = analysis.diagnostics(file_id).unwrap();
|
||||
assert_debug_snapshot_matches!(diagnostics, @r###"
|
||||
assert_debug_snapshot!(diagnostics, @r###"
|
||||
⋮[
|
||||
⋮ Diagnostic {
|
||||
⋮ message: "unresolved module",
|
||||
|
|
|
@ -161,7 +161,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
#[test]
|
||||
fn test_file_structure() {
|
||||
|
@ -204,7 +204,7 @@ fn very_obsolete() {}
|
|||
.ok()
|
||||
.unwrap();
|
||||
let structure = file_structure(&file);
|
||||
assert_debug_snapshot_matches!(structure,
|
||||
assert_debug_snapshot!(structure,
|
||||
@r#"[
|
||||
StructureNode {
|
||||
parent: None,
|
||||
|
|
|
@ -169,7 +169,7 @@ fn get_node_displayable_type(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::mock_analysis::single_file;
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
#[test]
|
||||
fn let_statement() {
|
||||
|
@ -210,7 +210,7 @@ fn main() {
|
|||
}"#,
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
InlayHint {
|
||||
range: [193; 197),
|
||||
kind: TypeHint,
|
||||
|
@ -277,7 +277,7 @@ fn main() {
|
|||
}"#,
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
InlayHint {
|
||||
range: [21; 30),
|
||||
kind: TypeHint,
|
||||
|
@ -304,7 +304,7 @@ fn main() {
|
|||
}"#,
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
InlayHint {
|
||||
range: [21; 30),
|
||||
kind: TypeHint,
|
||||
|
@ -350,7 +350,7 @@ fn main() {
|
|||
}"#,
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
InlayHint {
|
||||
range: [166; 170),
|
||||
kind: TypeHint,
|
||||
|
@ -411,7 +411,7 @@ fn main() {
|
|||
}"#,
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r###"
|
||||
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###"
|
||||
⋮[
|
||||
⋮ InlayHint {
|
||||
⋮ range: [166; 170),
|
||||
|
@ -474,7 +474,7 @@ fn main() {
|
|||
}"#,
|
||||
);
|
||||
|
||||
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[
|
||||
InlayHint {
|
||||
range: [311; 315),
|
||||
kind: TypeHint,
|
||||
|
|
|
@ -200,7 +200,7 @@ mod tests {
|
|||
mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId,
|
||||
ReferenceSearchResult,
|
||||
};
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
use test_utils::assert_eq_text;
|
||||
|
||||
#[test]
|
||||
|
@ -341,7 +341,7 @@ mod tests {
|
|||
);
|
||||
let new_name = "foo2";
|
||||
let source_change = analysis.rename(position, new_name).unwrap();
|
||||
assert_debug_snapshot_matches!(&source_change,
|
||||
assert_debug_snapshot!(&source_change,
|
||||
@r#"Some(
|
||||
SourceChange {
|
||||
label: "rename",
|
||||
|
@ -388,7 +388,7 @@ mod tests {
|
|||
);
|
||||
let new_name = "foo2";
|
||||
let source_change = analysis.rename(position, new_name).unwrap();
|
||||
assert_debug_snapshot_matches!(&source_change,
|
||||
assert_debug_snapshot!(&source_change,
|
||||
@r###"Some(
|
||||
SourceChange {
|
||||
label: "rename",
|
||||
|
|
|
@ -71,7 +71,7 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Opti
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
use crate::mock_analysis::analysis_and_position;
|
||||
|
||||
|
@ -92,7 +92,7 @@ mod tests {
|
|||
"#,
|
||||
);
|
||||
let runnables = analysis.runnables(pos.file_id).unwrap();
|
||||
assert_debug_snapshot_matches!(&runnables,
|
||||
assert_debug_snapshot!(&runnables,
|
||||
@r#"[
|
||||
Runnable {
|
||||
range: [1; 21),
|
||||
|
@ -127,7 +127,7 @@ mod tests {
|
|||
"#,
|
||||
);
|
||||
let runnables = analysis.runnables(pos.file_id).unwrap();
|
||||
assert_debug_snapshot_matches!(&runnables,
|
||||
assert_debug_snapshot!(&runnables,
|
||||
@r#"[
|
||||
Runnable {
|
||||
range: [1; 59),
|
||||
|
@ -160,7 +160,7 @@ mod tests {
|
|||
"#,
|
||||
);
|
||||
let runnables = analysis.runnables(pos.file_id).unwrap();
|
||||
assert_debug_snapshot_matches!(&runnables,
|
||||
assert_debug_snapshot!(&runnables,
|
||||
@r#"[
|
||||
Runnable {
|
||||
range: [23; 85),
|
||||
|
@ -195,7 +195,7 @@ mod tests {
|
|||
"#,
|
||||
);
|
||||
let runnables = analysis.runnables(pos.file_id).unwrap();
|
||||
assert_debug_snapshot_matches!(&runnables,
|
||||
assert_debug_snapshot!(&runnables,
|
||||
@r#"[
|
||||
Runnable {
|
||||
range: [41; 115),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue