Fix test_generics
diff --git a/tests/test_generics.rs b/tests/test_generics.rs
index bdeb171..6dd10af 100644
--- a/tests/test_generics.rs
+++ b/tests/test_generics.rs
@@ -16,13 +16,17 @@
extern crate quote;
extern crate proc_macro2;
-use proc_macro2::{Span, TokenStream};
+use proc_macro2::{Span, TokenStream, Ident};
#[macro_use]
mod macros;
mod common;
+fn ident(s: &str) -> Ident {
+ Ident::new(s, Span::call_site())
+}
+
#[test]
fn test_split_for_impl() {
// <'a, 'b: 'a, #[may_dangle] T: 'a = ()> where T: Debug
@@ -47,11 +51,11 @@
bracket_token: Default::default(),
pound_token: Default::default(),
style: AttrStyle::Outer,
- path: "may_dangle".into(),
+ path: ident("may_dangle").into(),
tts: TokenStream::empty(),
is_sugared_doc: false,
}],
- ident: "T".into(),
+ ident: ident("T"),
bounds: punctuated![TypeParamBound::Lifetime(Lifetime::new(
"'a",
Span::call_site()
@@ -73,13 +77,13 @@
colon_token: Default::default(),
bounded_ty: TypePath {
qself: None,
- path: "T".into(),
+ path: ident("T").into(),
}.into(),
bounds: punctuated![TypeParamBound::Trait(TraitBound {
paren_token: None,
modifier: TraitBoundModifier::None,
lifetimes: None,
- path: "Debug".into(),
+ path: ident("Debug").into(),
}),],
}),],
}),
@@ -114,6 +118,7 @@
);
let tokens = quote!('_);
+ println!("{:?}", tokens);
let expected = TypeParamBound::Lifetime(Lifetime::new("'_", Span::call_site()));
assert_eq!(
expected,
@@ -125,7 +130,7 @@
paren_token: None,
modifier: TraitBoundModifier::None,
lifetimes: None,
- path: "Debug".into(),
+ path: ident("Debug").into(),
});
assert_eq!(
expected,
@@ -137,7 +142,7 @@
paren_token: None,
modifier: TraitBoundModifier::Maybe(Default::default()),
lifetimes: None,
- path: "Sized".into(),
+ path: ident("Sized").into(),
});
assert_eq!(
expected,