align tests to code style

This commit is contained in:
Aleksey Kladov 2021-10-09 17:31:04 +03:00
parent 036c0ff8c7
commit a0d9e78ec3

View File

@ -52,9 +52,9 @@ fn match_by_first_token_literally() {
check( check(
r#" r#"
macro_rules! m { macro_rules! m {
($ i:ident) => ( mod $ i {} ); ($i:ident) => ( mod $i {} );
(= $ i:ident) => ( fn $ i() {} ); (= $i:ident) => ( fn $i() {} );
(+ $ i:ident) => ( struct $ i; ) (+ $i:ident) => ( struct $i; )
} }
m! { foo } m! { foo }
m! { = bar } m! { = bar }
@ -62,9 +62,9 @@ macro_rules! m {
"#, "#,
expect![[r#" expect![[r#"
macro_rules! m { macro_rules! m {
($ i:ident) => ( mod $ i {} ); ($i:ident) => ( mod $i {} );
(= $ i:ident) => ( fn $ i() {} ); (= $i:ident) => ( fn $i() {} );
(+ $ i:ident) => ( struct $ i; ) (+ $i:ident) => ( struct $i; )
} }
mod foo {} mod foo {}
fn bar() {} fn bar() {}
@ -78,9 +78,9 @@ fn match_by_last_token_literally() {
check( check(
r#" r#"
macro_rules! m { macro_rules! m {
($ i:ident) => ( mod $ i {} ); ($i:ident) => ( mod $i {} );
($ i:ident =) => ( fn $ i() {} ); ($i:ident =) => ( fn $i() {} );
($ i:ident +) => ( struct $ i; ) ($i:ident +) => ( struct $i; )
} }
m! { foo } m! { foo }
m! { bar = } m! { bar = }
@ -88,9 +88,9 @@ macro_rules! m {
"#, "#,
expect![[r#" expect![[r#"
macro_rules! m { macro_rules! m {
($ i:ident) => ( mod $ i {} ); ($i:ident) => ( mod $i {} );
($ i:ident =) => ( fn $ i() {} ); ($i:ident =) => ( fn $i() {} );
($ i:ident +) => ( struct $ i; ) ($i:ident +) => ( struct $i; )
} }
mod foo {} mod foo {}
fn bar() {} fn bar() {}
@ -104,9 +104,9 @@ fn match_by_ident() {
check( check(
r#" r#"
macro_rules! m { macro_rules! m {
($ i:ident) => ( mod $ i {} ); ($i:ident) => ( mod $i {} );
(spam $ i:ident) => ( fn $ i() {} ); (spam $i:ident) => ( fn $i() {} );
(eggs $ i:ident) => ( struct $ i; ) (eggs $i:ident) => ( struct $i; )
} }
m! { foo } m! { foo }
m! { spam bar } m! { spam bar }
@ -114,9 +114,9 @@ macro_rules! m {
"#, "#,
expect![[r#" expect![[r#"
macro_rules! m { macro_rules! m {
($ i:ident) => ( mod $ i {} ); ($i:ident) => ( mod $i {} );
(spam $ i:ident) => ( fn $ i() {} ); (spam $i:ident) => ( fn $i() {} );
(eggs $ i:ident) => ( struct $ i; ) (eggs $i:ident) => ( struct $i; )
} }
mod foo {} mod foo {}
fn bar() {} fn bar() {}
@ -130,9 +130,9 @@ fn match_by_separator_token() {
check( check(
r#" r#"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ($ ( mod $ i {} )*); ($($i:ident),*) => ($(mod $i {} )*);
($ ($ i:ident)#*) => ($ ( fn $ i() {} )*); ($($i:ident)#*) => ($(fn $i() {} )*);
($ i:ident ,# $ j:ident) => ( struct $ i; struct $ j; ) ($i:ident ,# $ j:ident) => ( struct $i; struct $ j; )
} }
m! { foo, bar } m! { foo, bar }
@ -143,9 +143,9 @@ macro_rules! m {
"#, "#,
expect![[r##" expect![[r##"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ($ ( mod $ i {} )*); ($($i:ident),*) => ($(mod $i {} )*);
($ ($ i:ident)#*) => ($ ( fn $ i() {} )*); ($($i:ident)#*) => ($(fn $i() {} )*);
($ i:ident ,# $ j:ident) => ( struct $ i; struct $ j; ) ($i:ident ,# $ j:ident) => ( struct $i; struct $ j; )
} }
mod foo {} mod foo {}
@ -165,13 +165,13 @@ fn test_match_group_pattern_with_multiple_defs() {
check( check(
r#" r#"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ( impl Bar { $ ( fn $ i {} )*} ); ($($i:ident),*) => ( impl Bar { $(fn $i {})* } );
} }
m! { foo, bar } m! { foo, bar }
"#, "#,
expect![[r#" expect![[r#"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ( impl Bar { $ ( fn $ i {} )*} ); ($($i:ident),*) => ( impl Bar { $(fn $i {})* } );
} }
impl Bar { impl Bar {
fn foo {} fn foo {}
@ -186,13 +186,13 @@ fn test_match_group_pattern_with_multiple_statement() {
check( check(
r#" r#"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ( fn baz { $ ( $ i (); )*} ); ($($i:ident),*) => ( fn baz { $($i ();)* } );
} }
m! { foo, bar } m! { foo, bar }
"#, "#,
expect![[r#" expect![[r#"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ( fn baz { $ ( $ i (); )*} ); ($($i:ident),*) => ( fn baz { $($i ();)* } );
} }
fn baz { fn baz {
foo(); foo();
@ -207,13 +207,13 @@ fn test_match_group_pattern_with_multiple_statement_without_semi() {
check( check(
r#" r#"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ( fn baz { $ ( $i() );*} ); ($($i:ident),*) => ( fn baz { $($i() );* } );
} }
m! { foo, bar } m! { foo, bar }
"#, "#,
expect![[r#" expect![[r#"
macro_rules! m { macro_rules! m {
($ ($ i:ident),*) => ( fn baz { $ ( $i() );*} ); ($($i:ident),*) => ( fn baz { $($i() );* } );
} }
fn baz { fn baz {
foo(); foo();