mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
move testing functions
This commit is contained in:
parent
98510ec5d3
commit
d5f6a5f5e2
10 changed files with 14 additions and 20 deletions
|
@ -21,7 +21,10 @@ use crate::{
|
||||||
completion_item::{Completions, CompletionKind},
|
completion_item::{Completions, CompletionKind},
|
||||||
completion_context::CompletionContext,
|
completion_context::CompletionContext,
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#[cfg(test)]
|
||||||
|
use crate::completion::completion_item::{do_completion, check_completion};
|
||||||
|
|
||||||
pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind, InsertTextFormat};
|
pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind, InsertTextFormat};
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,7 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::completion::*;
|
use crate::completion::{check_completion, CompletionKind};
|
||||||
use crate::completion::completion_item::check_completion;
|
|
||||||
|
|
||||||
fn check_ref_completion(name: &str, code: &str) {
|
fn check_ref_completion(name: &str, code: &str) {
|
||||||
check_completion(name, code, CompletionKind::Reference);
|
check_completion(name, code, CompletionKind::Reference);
|
||||||
|
|
|
@ -54,8 +54,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::completion::*;
|
use crate::completion::{check_completion, CompletionKind};
|
||||||
use crate::completion::completion_item::check_completion;
|
|
||||||
|
|
||||||
fn check_magic_completion(name: &str, code: &str) {
|
fn check_magic_completion(name: &str, code: &str) {
|
||||||
check_completion(name, code, CompletionKind::Magic);
|
check_completion(name, code, CompletionKind::Magic);
|
||||||
|
|
|
@ -109,8 +109,7 @@ fn complete_return(
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::completion::CompletionKind;
|
use crate::completion::{check_completion, CompletionKind};
|
||||||
use crate::completion::completion_item::check_completion;
|
|
||||||
|
|
||||||
fn check_keyword_completion(name: &str, code: &str) {
|
fn check_keyword_completion(name: &str, code: &str) {
|
||||||
check_completion(name, code, CompletionKind::Keyword);
|
check_completion(name, code, CompletionKind::Keyword);
|
||||||
|
|
|
@ -57,13 +57,10 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::completion::{
|
|
||||||
CompletionKind,
|
|
||||||
completion_item::{check_completion, do_completion},
|
|
||||||
};
|
|
||||||
|
|
||||||
use test_utils::covers;
|
use test_utils::covers;
|
||||||
|
|
||||||
|
use crate::completion::{CompletionKind, check_completion, do_completion};
|
||||||
|
|
||||||
fn check_reference_completion(code: &str, expected_completions: &str) {
|
fn check_reference_completion(code: &str, expected_completions: &str) {
|
||||||
check_completion(code, expected_completions, CompletionKind::Reference);
|
check_completion(code, expected_completions, CompletionKind::Reference);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::completion::completion_item::CompletionKind;
|
use crate::completion::{CompletionKind, check_completion};
|
||||||
use crate::completion::completion_item::check_completion;
|
|
||||||
|
|
||||||
fn check_snippet_completion(test_name: &str, code: &str) {
|
fn check_snippet_completion(test_name: &str, code: &str) {
|
||||||
check_completion(test_name, code, CompletionKind::Postfix);
|
check_completion(test_name, code, CompletionKind::Postfix);
|
||||||
|
|
|
@ -11,8 +11,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::completion::CompletionKind;
|
use crate::completion::{CompletionKind, check_completion};
|
||||||
use crate::completion::completion_item::check_completion;
|
|
||||||
|
|
||||||
fn check_reference_completion(name: &str, code: &str) {
|
fn check_reference_completion(name: &str, code: &str) {
|
||||||
check_completion(name, code, CompletionKind::Reference);
|
check_completion(name, code, CompletionKind::Reference);
|
||||||
|
|
|
@ -36,8 +36,7 @@ fn ${1:feature}() {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::completion::CompletionKind;
|
use crate::completion::{CompletionKind, check_completion};
|
||||||
use crate::completion::completion_item::check_completion;
|
|
||||||
|
|
||||||
fn check_snippet_completion(name: &str, code: &str) {
|
fn check_snippet_completion(name: &str, code: &str) {
|
||||||
check_completion(name, code, CompletionKind::Snippet);
|
check_completion(name, code, CompletionKind::Snippet);
|
||||||
|
|
|
@ -34,10 +34,10 @@ pub(super) fn complete_struct_literal(acc: &mut Completions, ctx: &CompletionCon
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use insta::assert_debug_snapshot_matches;
|
use insta::assert_debug_snapshot_matches;
|
||||||
use crate::completion::{CompletionItem, CompletionKind};
|
use crate::completion::{CompletionItem, CompletionKind, do_completion};
|
||||||
|
|
||||||
fn complete(code: &str) -> Vec<CompletionItem> {
|
fn complete(code: &str) -> Vec<CompletionItem> {
|
||||||
crate::completion::completion_item::do_completion(code, CompletionKind::Reference)
|
do_completion(code, CompletionKind::Reference)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -168,7 +168,7 @@ impl Completions {
|
||||||
mod tests {
|
mod tests {
|
||||||
use test_utils::covers;
|
use test_utils::covers;
|
||||||
|
|
||||||
use crate::completion::{CompletionKind, completion_item::check_completion};
|
use crate::completion::{CompletionKind, check_completion};
|
||||||
|
|
||||||
fn check_reference_completion(code: &str, expected_completions: &str) {
|
fn check_reference_completion(code: &str, expected_completions: &str) {
|
||||||
check_completion(code, expected_completions, CompletionKind::Reference);
|
check_completion(code, expected_completions, CompletionKind::Reference);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue