@@ -52,6 +52,165 @@ fn test_derive_empty() {
5252 ) ;
5353}
5454
55+ #[ test]
56+ fn test_derive_reemit_helpers ( ) {
57+ assert_expand (
58+ "DeriveReemit" ,
59+ r#"
60+ #[helper(build_fn(private, name = "partial_build"))]
61+ pub struct Foo {
62+ /// The domain where this federated instance is running
63+ #[helper(setter(into))]
64+ pub(crate) domain: String,
65+ }
66+ "# ,
67+ expect ! [ [ r#"
68+ PUNCT 1 # [joint]
69+ GROUP [] 1 1 1
70+ IDENT 1 helper
71+ GROUP () 1 1 1
72+ IDENT 1 build_fn
73+ GROUP () 1 1 1
74+ IDENT 1 private
75+ PUNCT 1 , [alone]
76+ IDENT 1 name
77+ PUNCT 1 = [alone]
78+ LITER 1 Str partial_build
79+ IDENT 1 pub
80+ IDENT 1 struct
81+ IDENT 1 Foo
82+ GROUP {} 1 1 1
83+ PUNCT 1 # [alone]
84+ GROUP [] 1 1 1
85+ IDENT 1 doc
86+ PUNCT 1 = [alone]
87+ LITER 1 Str / The domain where this federated instance is running
88+ PUNCT 1 # [joint]
89+ GROUP [] 1 1 1
90+ IDENT 1 helper
91+ GROUP () 1 1 1
92+ IDENT 1 setter
93+ GROUP () 1 1 1
94+ IDENT 1 into
95+ IDENT 1 pub
96+ GROUP () 1 1 1
97+ IDENT 1 crate
98+ IDENT 1 domain
99+ PUNCT 1 : [alone]
100+ IDENT 1 String
101+ PUNCT 1 , [alone]
102+
103+
104+ PUNCT 1 # [joint]
105+ GROUP [] 1 1 1
106+ IDENT 1 helper
107+ GROUP () 1 1 1
108+ IDENT 1 build_fn
109+ GROUP () 1 1 1
110+ IDENT 1 private
111+ PUNCT 1 , [alone]
112+ IDENT 1 name
113+ PUNCT 1 = [alone]
114+ LITER 1 Str partial_build
115+ IDENT 1 pub
116+ IDENT 1 struct
117+ IDENT 1 Foo
118+ GROUP {} 1 1 1
119+ PUNCT 1 # [alone]
120+ GROUP [] 1 1 1
121+ IDENT 1 doc
122+ PUNCT 1 = [alone]
123+ LITER 1 Str / The domain where this federated instance is running
124+ PUNCT 1 # [joint]
125+ GROUP [] 1 1 1
126+ IDENT 1 helper
127+ GROUP () 1 1 1
128+ IDENT 1 setter
129+ GROUP () 1 1 1
130+ IDENT 1 into
131+ IDENT 1 pub
132+ GROUP () 1 1 1
133+ IDENT 1 crate
134+ IDENT 1 domain
135+ PUNCT 1 : [alone]
136+ IDENT 1 String
137+ PUNCT 1 , [alone]
138+ "# ] ] ,
139+ expect ! [ [ r#"
140+ PUNCT 42:Root[0000, 0]@1..2#ROOT2024 # [joint]
141+ GROUP [] 42:Root[0000, 0]@2..3#ROOT2024 42:Root[0000, 0]@52..53#ROOT2024 42:Root[0000, 0]@2..53#ROOT2024
142+ IDENT 42:Root[0000, 0]@3..9#ROOT2024 helper
143+ GROUP () 42:Root[0000, 0]@9..10#ROOT2024 42:Root[0000, 0]@51..52#ROOT2024 42:Root[0000, 0]@9..52#ROOT2024
144+ IDENT 42:Root[0000, 0]@10..18#ROOT2024 build_fn
145+ GROUP () 42:Root[0000, 0]@18..19#ROOT2024 42:Root[0000, 0]@50..51#ROOT2024 42:Root[0000, 0]@18..51#ROOT2024
146+ IDENT 42:Root[0000, 0]@19..26#ROOT2024 private
147+ PUNCT 42:Root[0000, 0]@26..27#ROOT2024 , [alone]
148+ IDENT 42:Root[0000, 0]@28..32#ROOT2024 name
149+ PUNCT 42:Root[0000, 0]@33..34#ROOT2024 = [alone]
150+ LITER 42:Root[0000, 0]@35..50#ROOT2024 Str partial_build
151+ IDENT 42:Root[0000, 0]@54..57#ROOT2024 pub
152+ IDENT 42:Root[0000, 0]@58..64#ROOT2024 struct
153+ IDENT 42:Root[0000, 0]@65..68#ROOT2024 Foo
154+ GROUP {} 42:Root[0000, 0]@69..70#ROOT2024 42:Root[0000, 0]@190..191#ROOT2024 42:Root[0000, 0]@69..191#ROOT2024
155+ PUNCT 42:Root[0000, 0]@0..0#ROOT2024 # [alone]
156+ GROUP [] 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024
157+ IDENT 42:Root[0000, 0]@0..0#ROOT2024 doc
158+ PUNCT 42:Root[0000, 0]@0..0#ROOT2024 = [alone]
159+ LITER 42:Root[0000, 0]@75..130#ROOT2024 Str / The domain where this federated instance is running
160+ PUNCT 42:Root[0000, 0]@135..136#ROOT2024 # [joint]
161+ GROUP [] 42:Root[0000, 0]@136..137#ROOT2024 42:Root[0000, 0]@157..158#ROOT2024 42:Root[0000, 0]@136..158#ROOT2024
162+ IDENT 42:Root[0000, 0]@137..143#ROOT2024 helper
163+ GROUP () 42:Root[0000, 0]@143..144#ROOT2024 42:Root[0000, 0]@156..157#ROOT2024 42:Root[0000, 0]@143..157#ROOT2024
164+ IDENT 42:Root[0000, 0]@144..150#ROOT2024 setter
165+ GROUP () 42:Root[0000, 0]@150..151#ROOT2024 42:Root[0000, 0]@155..156#ROOT2024 42:Root[0000, 0]@150..156#ROOT2024
166+ IDENT 42:Root[0000, 0]@151..155#ROOT2024 into
167+ IDENT 42:Root[0000, 0]@163..166#ROOT2024 pub
168+ GROUP () 42:Root[0000, 0]@166..167#ROOT2024 42:Root[0000, 0]@172..173#ROOT2024 42:Root[0000, 0]@166..173#ROOT2024
169+ IDENT 42:Root[0000, 0]@167..172#ROOT2024 crate
170+ IDENT 42:Root[0000, 0]@174..180#ROOT2024 domain
171+ PUNCT 42:Root[0000, 0]@180..181#ROOT2024 : [alone]
172+ IDENT 42:Root[0000, 0]@182..188#ROOT2024 String
173+ PUNCT 42:Root[0000, 0]@188..189#ROOT2024 , [alone]
174+
175+
176+ PUNCT 42:Root[0000, 0]@1..2#ROOT2024 # [joint]
177+ GROUP [] 42:Root[0000, 0]@2..3#ROOT2024 42:Root[0000, 0]@52..53#ROOT2024 42:Root[0000, 0]@2..53#ROOT2024
178+ IDENT 42:Root[0000, 0]@3..9#ROOT2024 helper
179+ GROUP () 42:Root[0000, 0]@9..10#ROOT2024 42:Root[0000, 0]@51..52#ROOT2024 42:Root[0000, 0]@9..52#ROOT2024
180+ IDENT 42:Root[0000, 0]@10..18#ROOT2024 build_fn
181+ GROUP () 42:Root[0000, 0]@18..19#ROOT2024 42:Root[0000, 0]@50..51#ROOT2024 42:Root[0000, 0]@18..51#ROOT2024
182+ IDENT 42:Root[0000, 0]@19..26#ROOT2024 private
183+ PUNCT 42:Root[0000, 0]@26..27#ROOT2024 , [alone]
184+ IDENT 42:Root[0000, 0]@28..32#ROOT2024 name
185+ PUNCT 42:Root[0000, 0]@33..34#ROOT2024 = [alone]
186+ LITER 42:Root[0000, 0]@35..50#ROOT2024 Str partial_build
187+ IDENT 42:Root[0000, 0]@54..57#ROOT2024 pub
188+ IDENT 42:Root[0000, 0]@58..64#ROOT2024 struct
189+ IDENT 42:Root[0000, 0]@65..68#ROOT2024 Foo
190+ GROUP {} 42:Root[0000, 0]@69..70#ROOT2024 42:Root[0000, 0]@190..191#ROOT2024 42:Root[0000, 0]@69..191#ROOT2024
191+ PUNCT 42:Root[0000, 0]@0..0#ROOT2024 # [alone]
192+ GROUP [] 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024 42:Root[0000, 0]@0..0#ROOT2024
193+ IDENT 42:Root[0000, 0]@0..0#ROOT2024 doc
194+ PUNCT 42:Root[0000, 0]@0..0#ROOT2024 = [alone]
195+ LITER 42:Root[0000, 0]@75..130#ROOT2024 Str / The domain where this federated instance is running
196+ PUNCT 42:Root[0000, 0]@135..136#ROOT2024 # [joint]
197+ GROUP [] 42:Root[0000, 0]@136..137#ROOT2024 42:Root[0000, 0]@157..158#ROOT2024 42:Root[0000, 0]@136..158#ROOT2024
198+ IDENT 42:Root[0000, 0]@137..143#ROOT2024 helper
199+ GROUP () 42:Root[0000, 0]@143..144#ROOT2024 42:Root[0000, 0]@156..157#ROOT2024 42:Root[0000, 0]@143..157#ROOT2024
200+ IDENT 42:Root[0000, 0]@144..150#ROOT2024 setter
201+ GROUP () 42:Root[0000, 0]@150..151#ROOT2024 42:Root[0000, 0]@155..156#ROOT2024 42:Root[0000, 0]@150..156#ROOT2024
202+ IDENT 42:Root[0000, 0]@151..155#ROOT2024 into
203+ IDENT 42:Root[0000, 0]@163..166#ROOT2024 pub
204+ GROUP () 42:Root[0000, 0]@166..167#ROOT2024 42:Root[0000, 0]@172..173#ROOT2024 42:Root[0000, 0]@166..173#ROOT2024
205+ IDENT 42:Root[0000, 0]@167..172#ROOT2024 crate
206+ IDENT 42:Root[0000, 0]@174..180#ROOT2024 domain
207+ PUNCT 42:Root[0000, 0]@180..181#ROOT2024 : [alone]
208+ IDENT 42:Root[0000, 0]@182..188#ROOT2024 String
209+ PUNCT 42:Root[0000, 0]@188..189#ROOT2024 , [alone]
210+ "# ] ] ,
211+ ) ;
212+ }
213+
55214#[ test]
56215fn test_derive_error ( ) {
57216 assert_expand (
@@ -69,7 +228,7 @@ fn test_derive_error() {
69228 IDENT 1 compile_error
70229 PUNCT 1 ! [joint]
71230 GROUP () 1 1 1
72- LITER 1 Str #[derive(DeriveError)] struct S {field 58 u32 }
231+ LITER 1 Str #[derive(DeriveError)] struct S {field 58 u32}
73232 PUNCT 1 ; [alone]
74233 "# ] ] ,
75234 expect ! [ [ r#"
@@ -83,9 +242,9 @@ fn test_derive_error() {
83242
84243 IDENT 42:Root[0000, 0]@0..13#ROOT2024 compile_error
85244 PUNCT 42:Root[0000, 0]@13..14#ROOT2024 ! [joint]
86- GROUP () 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@64..65 #ROOT2024 42:Root[0000, 0]@14..65 #ROOT2024
87- LITER 42:Root[0000, 0]@15..64 #ROOT2024 Str #[derive(DeriveError)] struct S {field 58 u32 }
88- PUNCT 42:Root[0000, 0]@65..66 #ROOT2024 ; [alone]
245+ GROUP () 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@63..64 #ROOT2024 42:Root[0000, 0]@14..64 #ROOT2024
246+ LITER 42:Root[0000, 0]@15..63 #ROOT2024 Str #[derive(DeriveError)] struct S {field 58 u32}
247+ PUNCT 42:Root[0000, 0]@64..65 #ROOT2024 ; [alone]
89248 "# ] ] ,
90249 ) ;
91250}
@@ -472,7 +631,7 @@ fn test_attr_macro() {
472631 IDENT 1 compile_error
473632 PUNCT 1 ! [joint]
474633 GROUP () 1 1 1
475- LITER 1 Str #[attr_error(some arguments )] mod m {}
634+ LITER 1 Str #[attr_error(some arguments)] mod m {}
476635 PUNCT 1 ; [alone]
477636 "# ] ] ,
478637 expect ! [ [ r#"
@@ -487,9 +646,9 @@ fn test_attr_macro() {
487646
488647 IDENT 42:Root[0000, 0]@0..13#ROOT2024 compile_error
489648 PUNCT 42:Root[0000, 0]@13..14#ROOT2024 ! [joint]
490- GROUP () 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@56..57 #ROOT2024 42:Root[0000, 0]@14..57 #ROOT2024
491- LITER 42:Root[0000, 0]@15..56 #ROOT2024 Str #[attr_error(some arguments )] mod m {}
492- PUNCT 42:Root[0000, 0]@57..58 #ROOT2024 ; [alone]
649+ GROUP () 42:Root[0000, 0]@14..15#ROOT2024 42:Root[0000, 0]@55..56 #ROOT2024 42:Root[0000, 0]@14..56 #ROOT2024
650+ LITER 42:Root[0000, 0]@15..55 #ROOT2024 Str #[attr_error(some arguments)] mod m {}
651+ PUNCT 42:Root[0000, 0]@56..57 #ROOT2024 ; [alone]
493652 "# ] ] ,
494653 ) ;
495654}
@@ -535,6 +694,7 @@ fn list_test_macros() {
535694 attr_noop [Attr]
536695 attr_panic [Attr]
537696 attr_error [Attr]
697+ DeriveReemit [CustomDerive]
538698 DeriveEmpty [CustomDerive]
539699 DerivePanic [CustomDerive]
540700 DeriveError [CustomDerive]"# ] ]
0 commit comments