mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
move test
This commit is contained in:
parent
b0a104cbd1
commit
408475a593
2 changed files with 58 additions and 45 deletions
|
@ -878,3 +878,61 @@ mod c {}
|
||||||
"#]],
|
"#]],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_all_items() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! m { ($($i:item)*) => ($($i )*) }
|
||||||
|
m! {
|
||||||
|
extern crate a;
|
||||||
|
mod b;
|
||||||
|
mod c {}
|
||||||
|
use d;
|
||||||
|
const E: i32 = 0;
|
||||||
|
static F: i32 = 0;
|
||||||
|
impl G {}
|
||||||
|
struct H;
|
||||||
|
enum I { Foo }
|
||||||
|
trait J {}
|
||||||
|
fn h() {}
|
||||||
|
extern {}
|
||||||
|
type T = u8;
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
macro_rules! m { ($($i:item)*) => ($($i )*) }
|
||||||
|
extern crate a;
|
||||||
|
mod b;
|
||||||
|
mod c {}
|
||||||
|
use d;
|
||||||
|
const E:i32 = 0;
|
||||||
|
static F:i32 = 0;
|
||||||
|
impl G {}
|
||||||
|
struct H;
|
||||||
|
enum I {
|
||||||
|
Foo
|
||||||
|
}
|
||||||
|
trait J {}
|
||||||
|
fn h() {}
|
||||||
|
extern {}
|
||||||
|
type T = u8;
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_block() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! m { ($b:block) => { fn foo() $b } }
|
||||||
|
m! { { 1; } }
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
macro_rules! m { ($b:block) => { fn foo() $b } }
|
||||||
|
fn foo() {
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -101,51 +101,6 @@ fn test_attr_to_token_tree() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_all_items() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! foo {
|
|
||||||
($ ($ i:item)*) => ($ (
|
|
||||||
$ i
|
|
||||||
)*)
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
).
|
|
||||||
assert_expand_items(
|
|
||||||
r#"
|
|
||||||
foo! {
|
|
||||||
extern crate a;
|
|
||||||
mod b;
|
|
||||||
mod c {}
|
|
||||||
use d;
|
|
||||||
const E: i32 = 0;
|
|
||||||
static F: i32 = 0;
|
|
||||||
impl G {}
|
|
||||||
struct H;
|
|
||||||
enum I { Foo }
|
|
||||||
trait J {}
|
|
||||||
fn h() {}
|
|
||||||
extern {}
|
|
||||||
type T = u8;
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
r#"extern crate a ; mod b ; mod c {} use d ; const E : i32 = 0 ; static F : i32 = 0 ; impl G {} struct H ; enum I {Foo} trait J {} fn h () {} extern {} type T = u8 ;"#,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_block() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! foo {
|
|
||||||
($ i:block) => { fn foo() $ i }
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.assert_expand_statements("foo! { { 1; } }", "fn foo () {1 ;}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_meta() {
|
fn test_meta() {
|
||||||
parse_macro(
|
parse_macro(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue