Skip to content

Commit

Permalink
Add impl type parameter defaults test
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Apr 27, 2021
1 parent f6f10fd commit 70f8b8e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,27 @@ fn test_impl_visibility() {

snapshot!(tokens as Item, @"Verbatim(`pub default unsafe impl union { }`)");
}

#[test]
fn test_impl_type_parameter_defaults() {
#[cfg(any())]
impl<T = ()> () {}
let tokens = quote! {
impl<T = ()> () {}
};
snapshot!(tokens as Item, @r###"
Item::Impl {
generics: Generics {
lt_token: Some,
params: [
Type(TypeParam {
ident: "T",
eq_token: Some,
default: Some(Type::Tuple),
}),
],
gt_token: Some,
},
self_ty: Type::Tuple,
}"###);
}

0 comments on commit 70f8b8e

Please sign in to comment.