Move all use of snapshot to inline
diff --git a/tests/test_asyncness.rs b/tests/test_asyncness.rs
index 4d7ae7d..8289b3d 100644
--- a/tests/test_asyncness.rs
+++ b/tests/test_asyncness.rs
@@ -9,12 +9,33 @@
#[test]
fn test_async_fn() {
- let code = "async fn process() {}";
- snapshot!(code as Item);
+ let input = "async fn process() {}";
+
+ snapshot!(input as Item, @r###"
+ ⋮Item::Fn {
+ ⋮ vis: Inherited,
+ ⋮ asyncness: Some,
+ ⋮ ident: "process",
+ ⋮ decl: FnDecl {
+ ⋮ generics: Generics,
+ ⋮ output: Default,
+ ⋮ },
+ ⋮ block: Block,
+ ⋮}
+ "###);
}
#[test]
fn test_async_closure() {
- let code = "async || {}";
- snapshot!(code as Expr);
+ let input = "async || {}";
+
+ snapshot!(input as Expr, @r###"
+ ⋮Expr::Closure {
+ ⋮ asyncness: Some,
+ ⋮ output: Default,
+ ⋮ body: Expr::Block {
+ ⋮ block: Block,
+ ⋮ },
+ ⋮}
+ "###);
}
diff --git a/tests/test_attribute.rs b/tests/test_attribute.rs
index ab21544..2a7e106 100644
--- a/tests/test_attribute.rs
+++ b/tests/test_attribute.rs
@@ -6,62 +6,274 @@
mod macros;
use syn::parse::Parser;
-use syn::Attribute;
+use syn::{Attribute, Meta};
#[test]
fn test_meta_item_word() {
- test("#[foo]")
+ let (interpret, parse) = test("#[foo]");
+
+ snapshot!(interpret, @r###"Word("foo")"###);
+
+ snapshot!(parse, @r###"Word("foo")"###);
}
#[test]
fn test_meta_item_name_value() {
- test("#[foo = 5]")
+ let (interpret, parse) = test("#[foo = 5]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_bool_value() {
- test("#[foo = true]");
- test("#[foo = false]")
+ let (interpret, parse) = test("#[foo = true]");;
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮}
+ "###);
+
+ let (interpret, parse) = test("#[foo = false]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: false,
+ ⋮ },
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: false,
+ ⋮ },
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_lit() {
- test("#[foo(5)]")
+ let (interpret, parse) = test("#[foo(5)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_word() {
- test("#[foo(bar)]")
+ let (interpret, parse) = test("#[foo(bar)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("bar")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("bar")),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_name_value() {
- test("#[foo(bar = 5)]")
+ let (interpret, parse) = test("#[foo(bar = 5)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_list_bool_value() {
- test("#[foo(bar = true)]")
+ let (interpret, parse) = test("#[foo(bar = true)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "bar",
+ ⋮ lit: Lit::Bool {
+ ⋮ value: true,
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_meta_item_multiple() {
- test("#[foo(word, name = 5, list(name2 = 6), word2)]")
+ let (interpret, parse) = test("#[foo(word, name = 5, list(name2 = 6), word2)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
}
#[test]
fn test_bool_lit() {
- test("#[foo(true)]")
+ let (interpret, parse) = test("#[foo(true)]");
+
+ snapshot!(interpret, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(Lit::Bool {
+ ⋮ value: true,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(parse, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(Lit::Bool {
+ ⋮ value: true,
+ ⋮ }),
+ ⋮ ],
+ ⋮}
+ "###);
}
-fn test(input: &str) {
+fn test(input: &str) -> (Meta, Meta) {
let attrs = Attribute::parse_outer.parse_str(input).unwrap();
assert_eq!(attrs.len(), 1);
-
let attr = attrs.into_iter().next().unwrap();
- let interpret = snapshot!(attr.interpret_meta().unwrap());
- let parse = snapshot!(attr.parse_meta().unwrap());
+ let interpret = attr.interpret_meta().unwrap();
+ let parse = attr.parse_meta().unwrap();
assert_eq!(interpret, parse);
+
+ (interpret, parse)
}
diff --git a/tests/test_generics.rs b/tests/test_generics.rs
index 112215a..27b204e 100644
--- a/tests/test_generics.rs
+++ b/tests/test_generics.rs
@@ -11,13 +11,98 @@
#[test]
fn test_split_for_impl() {
- let code = quote! {
+ let input = quote! {
struct S<'a, 'b: 'a, #[may_dangle] T: 'a = ()> where T: Debug;
};
- let actual = snapshot!(code as DeriveInput);
+ snapshot!(input as DeriveInput, @r###"
+ ⋮DeriveInput {
+ ⋮ vis: Inherited,
+ ⋮ ident: "S",
+ ⋮ generics: Generics {
+ ⋮ lt_token: Some,
+ ⋮ params: [
+ ⋮ Lifetime(LifetimeDef {
+ ⋮ lifetime: Lifetime {
+ ⋮ ident: "a",
+ ⋮ },
+ ⋮ }),
+ ⋮ Lifetime(LifetimeDef {
+ ⋮ lifetime: Lifetime {
+ ⋮ ident: "b",
+ ⋮ },
+ ⋮ colon_token: Some,
+ ⋮ bounds: [
+ ⋮ Lifetime {
+ ⋮ ident: "a",
+ ⋮ },
+ ⋮ ],
+ ⋮ }),
+ ⋮ Type(TypeParam {
+ ⋮ attrs: [
+ ⋮ Attribute {
+ ⋮ style: Outer,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "may_dangle",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ tts: ``,
+ ⋮ },
+ ⋮ ],
+ ⋮ ident: "T",
+ ⋮ colon_token: Some,
+ ⋮ bounds: [
+ ⋮ Lifetime(Lifetime {
+ ⋮ ident: "a",
+ ⋮ }),
+ ⋮ ],
+ ⋮ eq_token: Some,
+ ⋮ default: Some(Type::Tuple),
+ ⋮ }),
+ ⋮ ],
+ ⋮ gt_token: Some,
+ ⋮ where_clause: Some(WhereClause {
+ ⋮ predicates: [
+ ⋮ Type(PredicateType {
+ ⋮ bounded_ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "T",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ bounds: [
+ ⋮ Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Debug",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ },
+ ⋮ data: Data::Struct {
+ ⋮ fields: Unit,
+ ⋮ semi_token: Some,
+ ⋮ },
+ ⋮}
+ "###);
- let generics = actual.generics;
+ let generics = input.generics;
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
let generated = quote! {
@@ -45,23 +130,55 @@
#[test]
fn test_ty_param_bound() {
let tokens = quote!('a);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Lifetime(Lifetime {
+ ⋮ ident: "a",
+ ⋮})
+ "###);
let tokens = quote!('_);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Lifetime(Lifetime {
+ ⋮ ident: "_",
+ ⋮})
+ "###);
let tokens = quote!(Debug);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Debug",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮})
+ "###);
let tokens = quote!(?Sized);
- snapshot!(tokens as TypeParamBound);
+ snapshot!(tokens as TypeParamBound, @r###"
+ ⋮Trait(TraitBound {
+ ⋮ modifier: Maybe,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Sized",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮})
+ "###);
}
#[test]
fn test_fn_precedence_in_where_clause() {
// This should parse as two separate bounds, `FnOnce() -> i32` and `Send` - not
// `FnOnce() -> (i32 + Send)`.
- let code = quote! {
+ let input = quote! {
fn f<G>()
where
G: FnOnce() -> i32 + Send,
@@ -69,9 +186,80 @@
}
};
- let actual = snapshot!(code as ItemFn);
+ snapshot!(input as ItemFn, @r###"
+ ⋮ItemFn {
+ ⋮ vis: Inherited,
+ ⋮ ident: "f",
+ ⋮ decl: FnDecl {
+ ⋮ generics: Generics {
+ ⋮ lt_token: Some,
+ ⋮ params: [
+ ⋮ Type(TypeParam {
+ ⋮ ident: "G",
+ ⋮ }),
+ ⋮ ],
+ ⋮ gt_token: Some,
+ ⋮ where_clause: Some(WhereClause {
+ ⋮ predicates: [
+ ⋮ Type(PredicateType {
+ ⋮ bounded_ty: Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "G",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ bounds: [
+ ⋮ Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "FnOnce",
+ ⋮ arguments: PathArguments::Parenthesized {
+ ⋮ output: Type(
+ ⋮ Type::Path {
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "i32",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ },
+ ⋮ ),
+ ⋮ },
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ }),
+ ⋮ Trait(TraitBound {
+ ⋮ modifier: None,
+ ⋮ path: Path {
+ ⋮ segments: [
+ ⋮ PathSegment {
+ ⋮ ident: "Send",
+ ⋮ arguments: None,
+ ⋮ },
+ ⋮ ],
+ ⋮ },
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ },
+ ⋮ output: Default,
+ ⋮ },
+ ⋮ block: Block,
+ ⋮}
+ "###);
- let where_clause = actual.decl.generics.where_clause.as_ref().unwrap();
+ let where_clause = input.decl.generics.where_clause.as_ref().unwrap();
assert_eq!(where_clause.predicates.len(), 1);
let predicate = match &where_clause.predicates[0] {
@@ -90,10 +278,11 @@
#[test]
fn test_where_clause_at_end_of_input() {
- let tokens = quote! {
+ let input = quote! {
where
};
- let where_clause = snapshot!(tokens as WhereClause);
- assert_eq!(where_clause.predicates.len(), 0);
+ snapshot!(input as WhereClause, @"WhereClause");
+
+ assert_eq!(input.predicates.len(), 0);
}
diff --git a/tests/test_grouping.rs b/tests/test_grouping.rs
index df309ad..6ca438d 100644
--- a/tests/test_grouping.rs
+++ b/tests/test_grouping.rs
@@ -30,5 +30,29 @@
assert_eq!(tokens.to_string(), "1i32 + 2i32 + 3i32 * 4i32");
- snapshot!(tokens as Expr);
+ snapshot!(tokens as Expr, @r###"
+ ⋮Expr::Binary {
+ ⋮ left: Expr::Lit {
+ ⋮ lit: 1,
+ ⋮ },
+ ⋮ op: Add,
+ ⋮ right: Expr::Binary {
+ ⋮ left: Expr::Group {
+ ⋮ expr: Expr::Binary {
+ ⋮ left: Expr::Lit {
+ ⋮ lit: 2,
+ ⋮ },
+ ⋮ op: Add,
+ ⋮ right: Expr::Lit {
+ ⋮ lit: 3,
+ ⋮ },
+ ⋮ },
+ ⋮ },
+ ⋮ op: Mul,
+ ⋮ right: Expr::Lit {
+ ⋮ lit: 4,
+ ⋮ },
+ ⋮ },
+ ⋮}
+ "###);
}
diff --git a/tests/test_meta.rs b/tests/test_meta.rs
index 5a8cba7..97639cf 100644
--- a/tests/test_meta.rs
+++ b/tests/test_meta.rs
@@ -5,57 +5,176 @@
#[macro_use]
mod macros;
-use std::fmt::Debug;
-use syn::parse::Parse;
use syn::{Meta, MetaList, MetaNameValue, NestedMeta};
#[test]
fn test_parse_meta_item_word() {
- let code = "hello";
+ let input = "hello";
- snapshot!(code as Meta);
+ snapshot!(input as Meta, @r###"Word("hello")"###);
}
#[test]
fn test_parse_meta_name_value() {
- test::<MetaNameValue>("foo = 5");
+ let input = "foo = 5";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaNameValue, @r###"
+ ⋮MetaNameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "foo",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_name_value_with_keyword() {
- test::<MetaNameValue>("static = 5");
+ let input = "static = 5";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaNameValue, @r###"
+ ⋮MetaNameValue {
+ ⋮ ident: "static",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "static",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_name_value_with_bool() {
- test::<MetaNameValue>("true = 5");
+ let input = "true = 5";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaNameValue, @r###"
+ ⋮MetaNameValue {
+ ⋮ ident: "true",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::NameValue {
+ ⋮ ident: "true",
+ ⋮ lit: 5,
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_item_list_lit() {
- test::<MetaList>("foo(5)");
+ let input = "foo(5)";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaList, @r###"
+ ⋮MetaList {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Literal(5),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_meta_item_multiple() {
- test::<MetaList>("foo(word, name = 5, list(name2 = 6), word2)");
+ let input = "foo(word, name = 5, list(name2 = 6), word2)";
+ let (inner, meta) = (input, input);
+
+ snapshot!(inner as MetaList, @r###"
+ ⋮MetaList {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ snapshot!(meta as Meta, @r###"
+ ⋮Meta::List {
+ ⋮ ident: "foo",
+ ⋮ nested: [
+ ⋮ Meta(Word("word")),
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name",
+ ⋮ lit: 5,
+ ⋮ }),
+ ⋮ Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮ }),
+ ⋮ Meta(Word("word2")),
+ ⋮ ],
+ ⋮}
+ "###);
+
+ assert_eq!(meta, inner.into());
}
#[test]
fn test_parse_nested_meta() {
- let code = "5";
- snapshot!(code as NestedMeta);
+ let input = "5";
+ snapshot!(input as NestedMeta, @"Literal(5)");
- let code = "list(name2 = 6)";
- snapshot!(code as NestedMeta);
-}
-
-fn test<T>(input: &str)
-where
- T: Parse + Into<Meta> + Debug,
-{
- let inner = snapshot!(input as T);
- let meta = snapshot!(input as Meta);
-
- assert_eq!(meta, inner.into());
+ let input = "list(name2 = 6)";
+ snapshot!(input as NestedMeta, @r###"
+ ⋮Meta(Meta::List {
+ ⋮ ident: "list",
+ ⋮ nested: [
+ ⋮ Meta(Meta::NameValue {
+ ⋮ ident: "name2",
+ ⋮ lit: 6,
+ ⋮ }),
+ ⋮ ],
+ ⋮})
+ "###);
}
diff --git a/tests/test_token_trees.rs b/tests/test_token_trees.rs
index 6e2d2dd..70a9a72 100644
--- a/tests/test_token_trees.rs
+++ b/tests/test_token_trees.rs
@@ -13,7 +13,7 @@
#[test]
fn test_struct() {
- let code = "
+ let input = "
#[derive(Debug, Clone)]
pub struct Item {
pub ident: Ident,
@@ -21,7 +21,7 @@
}
";
- snapshot!(code as TokenStream);
+ snapshot!(input as TokenStream, @"`# [ derive ( Debug , Clone ) ] pub struct Item { pub ident : Ident , pub attrs : Vec < Attribute >, }`");
}
#[test]