mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
move test
This commit is contained in:
parent
af76db3c36
commit
be73cc8f83
@ -640,3 +640,91 @@ quick_error!(ENUMINITION[enum Wrapped#[derive(Debug)]]body[]queue[ = > One: UNIT
|
|||||||
"##]],
|
"##]],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_empty_repeat_vars_in_empty_repeat_vars() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! delegate_impl {
|
||||||
|
([$self_type:ident, $self_wrap:ty, $self_map:ident]
|
||||||
|
pub trait $name:ident $(: $sup:ident)* $(+ $more_sup:ident)* {
|
||||||
|
|
||||||
|
$(
|
||||||
|
@escape [type $assoc_name_ext:ident]
|
||||||
|
)*
|
||||||
|
$(
|
||||||
|
@section type
|
||||||
|
$(
|
||||||
|
$(#[$_assoc_attr:meta])*
|
||||||
|
type $assoc_name:ident $(: $assoc_bound:ty)*;
|
||||||
|
)+
|
||||||
|
)*
|
||||||
|
$(
|
||||||
|
@section self
|
||||||
|
$(
|
||||||
|
$(#[$_method_attr:meta])*
|
||||||
|
fn $method_name:ident(self $(: $self_selftype:ty)* $(,$marg:ident : $marg_ty:ty)*) -> $mret:ty;
|
||||||
|
)+
|
||||||
|
)*
|
||||||
|
$(
|
||||||
|
@section nodelegate
|
||||||
|
$($tail:tt)*
|
||||||
|
)*
|
||||||
|
}) => {
|
||||||
|
impl<> $name for $self_wrap where $self_type: $name {
|
||||||
|
$(
|
||||||
|
$(
|
||||||
|
fn $method_name(self $(: $self_selftype)* $(,$marg: $marg_ty)*) -> $mret {
|
||||||
|
$self_map!(self).$method_name($($marg),*)
|
||||||
|
}
|
||||||
|
)*
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delegate_impl ! {
|
||||||
|
[G, &'a mut G, deref] pub trait Data: GraphBase {@section type type NodeWeight;}
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r##"
|
||||||
|
macro_rules! delegate_impl {
|
||||||
|
([$self_type:ident, $self_wrap:ty, $self_map:ident]
|
||||||
|
pub trait $name:ident $(: $sup:ident)* $(+ $more_sup:ident)* {
|
||||||
|
|
||||||
|
$(
|
||||||
|
@escape [type $assoc_name_ext:ident]
|
||||||
|
)*
|
||||||
|
$(
|
||||||
|
@section type
|
||||||
|
$(
|
||||||
|
$(#[$_assoc_attr:meta])*
|
||||||
|
type $assoc_name:ident $(: $assoc_bound:ty)*;
|
||||||
|
)+
|
||||||
|
)*
|
||||||
|
$(
|
||||||
|
@section self
|
||||||
|
$(
|
||||||
|
$(#[$_method_attr:meta])*
|
||||||
|
fn $method_name:ident(self $(: $self_selftype:ty)* $(,$marg:ident : $marg_ty:ty)*) -> $mret:ty;
|
||||||
|
)+
|
||||||
|
)*
|
||||||
|
$(
|
||||||
|
@section nodelegate
|
||||||
|
$($tail:tt)*
|
||||||
|
)*
|
||||||
|
}) => {
|
||||||
|
impl<> $name for $self_wrap where $self_type: $name {
|
||||||
|
$(
|
||||||
|
$(
|
||||||
|
fn $method_name(self $(: $self_selftype)* $(,$marg: $marg_ty)*) -> $mret {
|
||||||
|
$self_map!(self).$method_name($($marg),*)
|
||||||
|
}
|
||||||
|
)*
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl <> Data for & 'amut G where G: Data {}
|
||||||
|
"##]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -98,54 +98,6 @@ fn test_attr_to_token_tree() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_empty_repeat_vars_in_empty_repeat_vars() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! delegate_impl {
|
|
||||||
([$self_type:ident, $self_wrap:ty, $self_map:ident]
|
|
||||||
pub trait $name:ident $(: $sup:ident)* $(+ $more_sup:ident)* {
|
|
||||||
|
|
||||||
$(
|
|
||||||
@escape [type $assoc_name_ext:ident]
|
|
||||||
)*
|
|
||||||
$(
|
|
||||||
@section type
|
|
||||||
$(
|
|
||||||
$(#[$_assoc_attr:meta])*
|
|
||||||
type $assoc_name:ident $(: $assoc_bound:ty)*;
|
|
||||||
)+
|
|
||||||
)*
|
|
||||||
$(
|
|
||||||
@section self
|
|
||||||
$(
|
|
||||||
$(#[$_method_attr:meta])*
|
|
||||||
fn $method_name:ident(self $(: $self_selftype:ty)* $(,$marg:ident : $marg_ty:ty)*) -> $mret:ty;
|
|
||||||
)+
|
|
||||||
)*
|
|
||||||
$(
|
|
||||||
@section nodelegate
|
|
||||||
$($tail:tt)*
|
|
||||||
)*
|
|
||||||
}) => {
|
|
||||||
impl<> $name for $self_wrap where $self_type: $name {
|
|
||||||
$(
|
|
||||||
$(
|
|
||||||
fn $method_name(self $(: $self_selftype)* $(,$marg: $marg_ty)*) -> $mret {
|
|
||||||
$self_map!(self).$method_name($($marg),*)
|
|
||||||
}
|
|
||||||
)*
|
|
||||||
)*
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
).assert_expand_items(
|
|
||||||
r#"delegate_impl ! {[G , & 'a mut G , deref] pub trait Data : GraphBase {@ section type type NodeWeight ;}}"#,
|
|
||||||
"impl <> Data for & \'a mut G where G : Data {}",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expr_interpolation() {
|
fn expr_interpolation() {
|
||||||
let expanded = parse_macro(
|
let expanded = parse_macro(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user