mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Move rendering tests to the render module
This commit is contained in:
parent
15b16917fc
commit
97a504805d
6 changed files with 1163 additions and 1095 deletions
|
@ -114,3 +114,93 @@ fn guess_macro_braces(macro_name: &str, docs: &str) -> (&'static str, &'static s
|
|||
.unwrap();
|
||||
(*bra, *ket)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::test_utils::check_edit;
|
||||
|
||||
#[test]
|
||||
fn dont_insert_macro_call_parens_unncessary() {
|
||||
mark::check!(dont_insert_macro_call_parens_unncessary);
|
||||
check_edit(
|
||||
"frobnicate!",
|
||||
r#"
|
||||
//- /main.rs crate:main deps:foo
|
||||
use foo::<|>;
|
||||
//- /foo/lib.rs crate:foo
|
||||
#[macro_export]
|
||||
macro_rules frobnicate { () => () }
|
||||
"#,
|
||||
r#"
|
||||
use foo::frobnicate;
|
||||
"#,
|
||||
);
|
||||
|
||||
check_edit(
|
||||
"frobnicate!",
|
||||
r#"
|
||||
macro_rules frobnicate { () => () }
|
||||
fn main() { frob<|>!(); }
|
||||
"#,
|
||||
r#"
|
||||
macro_rules frobnicate { () => () }
|
||||
fn main() { frobnicate!(); }
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn guesses_macro_braces() {
|
||||
check_edit(
|
||||
"vec!",
|
||||
r#"
|
||||
/// Creates a [`Vec`] containing the arguments.
|
||||
///
|
||||
/// ```
|
||||
/// let v = vec![1, 2, 3];
|
||||
/// assert_eq!(v[0], 1);
|
||||
/// assert_eq!(v[1], 2);
|
||||
/// assert_eq!(v[2], 3);
|
||||
/// ```
|
||||
macro_rules! vec { () => {} }
|
||||
|
||||
fn fn main() { v<|> }
|
||||
"#,
|
||||
r#"
|
||||
/// Creates a [`Vec`] containing the arguments.
|
||||
///
|
||||
/// ```
|
||||
/// let v = vec![1, 2, 3];
|
||||
/// assert_eq!(v[0], 1);
|
||||
/// assert_eq!(v[1], 2);
|
||||
/// assert_eq!(v[2], 3);
|
||||
/// ```
|
||||
macro_rules! vec { () => {} }
|
||||
|
||||
fn fn main() { vec![$0] }
|
||||
"#,
|
||||
);
|
||||
|
||||
check_edit(
|
||||
"foo!",
|
||||
r#"
|
||||
/// Foo
|
||||
///
|
||||
/// Don't call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`,
|
||||
/// call as `let _=foo! { hello world };`
|
||||
macro_rules! foo { () => {} }
|
||||
fn main() { <|> }
|
||||
"#,
|
||||
r#"
|
||||
/// Foo
|
||||
///
|
||||
/// Don't call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`,
|
||||
/// call as `let _=foo! { hello world };`
|
||||
macro_rules! foo { () => {} }
|
||||
fn main() { foo! {$0} }
|
||||
"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue