mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
internal: move tests
This commit is contained in:
parent
c6d5c1c946
commit
1c15f47e00
@ -778,3 +778,45 @@ x!();
|
|||||||
"#]],
|
"#]],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_ty() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! foo {
|
||||||
|
($t:ty) => ( fn bar() -> $t {} )
|
||||||
|
}
|
||||||
|
foo! { Baz<u8> }
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
macro_rules! foo {
|
||||||
|
($t:ty) => ( fn bar() -> $t {} )
|
||||||
|
}
|
||||||
|
fn bar() -> Baz<u8> {}
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_ty_with_complex_type() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! foo {
|
||||||
|
($t:ty) => ( fn bar() -> $ t {} )
|
||||||
|
}
|
||||||
|
|
||||||
|
foo! { &'a Baz<u8> }
|
||||||
|
|
||||||
|
foo! { extern "Rust" fn() -> Ret }
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
macro_rules! foo {
|
||||||
|
($t:ty) => ( fn bar() -> $ t {} )
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bar() -> & 'a Baz<u8> {}
|
||||||
|
|
||||||
|
fn bar() -> extern"Rust"fn() -> Ret {}
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -101,43 +101,6 @@ fn test_attr_to_token_tree() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_ty() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! foo {
|
|
||||||
($ i:ty) => (
|
|
||||||
fn bar() -> $ i { unimplemented!() }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.assert_expand_items("foo! { Baz<u8> }", "fn bar () -> Baz < u8 > {unimplemented ! ()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_ty_with_complex_type() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! foo {
|
|
||||||
($ i:ty) => (
|
|
||||||
fn bar() -> $ i { unimplemented!() }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
// Reference lifetime struct with generic type
|
|
||||||
.assert_expand_items(
|
|
||||||
"foo! { &'a Baz<u8> }",
|
|
||||||
"fn bar () -> & 'a Baz < u8 > {unimplemented ! ()}",
|
|
||||||
)
|
|
||||||
// extern "Rust" func type
|
|
||||||
.assert_expand_items(
|
|
||||||
r#"foo! { extern "Rust" fn() -> Ret }"#,
|
|
||||||
r#"fn bar () -> extern "Rust" fn () -> Ret {unimplemented ! ()}"#,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pat_() {
|
fn test_pat_() {
|
||||||
parse_macro(
|
parse_macro(
|
||||||
|
Loading…
Reference in New Issue
Block a user