4423: add tests module snippet r=bnjjj a=bnjjj

Request from a friend coming from intellij Rust

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
bors[bot] 2020-05-11 18:15:31 +00:00 committed by GitHub
commit 2c9878a2fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,6 +33,24 @@ pub(super) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionConte
None => return,
};
snippet(
ctx,
cap,
"Test module",
"\
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn ${1:test_name}() {
$0
}
}",
)
.lookup_by("tmod")
.add_to(acc);
snippet(
ctx,
cap,
@ -117,6 +135,14 @@ mod tests {
kind: Snippet,
lookup: "tfn",
},
CompletionItem {
label: "Test module",
source_range: 78..78,
delete: 78..78,
insert: "#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn ${1:test_name}() {\n $0\n }\n}",
kind: Snippet,
lookup: "tmod",
},
CompletionItem {
label: "macro_rules",
source_range: 78..78,