@@ -186,81 +186,85 @@ pub fn expand_test_or_bench(
186186 ast:: ItemKind :: Const (
187187 cx. ty ( sp, ast:: TyKind :: Path ( None , test_path ( "TestDescAndFn" ) ) ) ,
188188 // test::TestDescAndFn {
189- cx. expr_struct (
190- sp,
191- test_path ( "TestDescAndFn" ) ,
192- vec ! [
193- // desc: test::TestDesc {
194- field(
195- "desc" ,
196- cx. expr_struct(
197- sp,
198- test_path( "TestDesc" ) ,
199- vec![
200- // name: "path::to::test"
201- field(
202- "name" ,
203- cx. expr_call(
204- sp,
205- cx. expr_path( test_path( "StaticTestName" ) ) ,
206- vec![ cx. expr_str(
207- sp,
208- Symbol :: intern( & item_path(
209- // skip the name of the root module
210- & cx. current_expansion. module. mod_path[ 1 ..] ,
211- & item. ident,
212- ) ) ,
213- ) ] ,
214- ) ,
215- ) ,
216- // ignore: true | false
217- field( "ignore" , cx. expr_bool( sp, should_ignore( & item) ) ) ,
218- // allow_fail: true | false
219- field( "allow_fail" , cx. expr_bool( sp, should_fail( & item) ) ) ,
220- // should_panic: ...
221- field(
222- "should_panic" ,
223- match should_panic( cx, & item) {
224- // test::ShouldPanic::No
225- ShouldPanic :: No => cx. expr_path( should_panic_path( "No" ) ) ,
226- // test::ShouldPanic::Yes
227- ShouldPanic :: Yes ( None ) => {
228- cx. expr_path( should_panic_path( "Yes" ) )
229- }
230- // test::ShouldPanic::YesWithMessage("...")
231- ShouldPanic :: Yes ( Some ( sym) ) => cx. expr_call(
189+ Some (
190+ cx. expr_struct (
191+ sp,
192+ test_path ( "TestDescAndFn" ) ,
193+ vec ! [
194+ // desc: test::TestDesc {
195+ field(
196+ "desc" ,
197+ cx. expr_struct(
198+ sp,
199+ test_path( "TestDesc" ) ,
200+ vec![
201+ // name: "path::to::test"
202+ field(
203+ "name" ,
204+ cx. expr_call(
232205 sp,
233- cx. expr_path( should_panic_path( "YesWithMessage" ) ) ,
234- vec![ cx. expr_str( sp, sym) ] ,
206+ cx. expr_path( test_path( "StaticTestName" ) ) ,
207+ vec![ cx. expr_str(
208+ sp,
209+ Symbol :: intern( & item_path(
210+ // skip the name of the root module
211+ & cx. current_expansion. module. mod_path[ 1 ..] ,
212+ & item. ident,
213+ ) ) ,
214+ ) ] ,
235215 ) ,
236- } ,
237- ) ,
238- // test_type: ...
239- field(
240- "test_type" ,
241- match test_type( cx) {
242- // test::TestType::UnitTest
243- TestType :: UnitTest => {
244- cx. expr_path( test_type_path( "UnitTest" ) )
245- }
246- // test::TestType::IntegrationTest
247- TestType :: IntegrationTest => {
248- cx. expr_path( test_type_path( "IntegrationTest" ) )
249- }
250- // test::TestPath::Unknown
251- TestType :: Unknown => {
252- cx. expr_path( test_type_path( "Unknown" ) )
253- }
254- } ,
255- ) ,
256- // },
257- ] ,
216+ ) ,
217+ // ignore: true | false
218+ field( "ignore" , cx. expr_bool( sp, should_ignore( & item) ) ) ,
219+ // allow_fail: true | false
220+ field( "allow_fail" , cx. expr_bool( sp, should_fail( & item) ) ) ,
221+ // should_panic: ...
222+ field(
223+ "should_panic" ,
224+ match should_panic( cx, & item) {
225+ // test::ShouldPanic::No
226+ ShouldPanic :: No => {
227+ cx. expr_path( should_panic_path( "No" ) )
228+ }
229+ // test::ShouldPanic::Yes
230+ ShouldPanic :: Yes ( None ) => {
231+ cx. expr_path( should_panic_path( "Yes" ) )
232+ }
233+ // test::ShouldPanic::YesWithMessage("...")
234+ ShouldPanic :: Yes ( Some ( sym) ) => cx. expr_call(
235+ sp,
236+ cx. expr_path( should_panic_path( "YesWithMessage" ) ) ,
237+ vec![ cx. expr_str( sp, sym) ] ,
238+ ) ,
239+ } ,
240+ ) ,
241+ // test_type: ...
242+ field(
243+ "test_type" ,
244+ match test_type( cx) {
245+ // test::TestType::UnitTest
246+ TestType :: UnitTest => {
247+ cx. expr_path( test_type_path( "UnitTest" ) )
248+ }
249+ // test::TestType::IntegrationTest
250+ TestType :: IntegrationTest => {
251+ cx. expr_path( test_type_path( "IntegrationTest" ) )
252+ }
253+ // test::TestPath::Unknown
254+ TestType :: Unknown => {
255+ cx. expr_path( test_type_path( "Unknown" ) )
256+ }
257+ } ,
258+ ) ,
259+ // },
260+ ] ,
261+ ) ,
258262 ) ,
259- ) ,
260- // testfn: test::StaticTestFn(...) | test::StaticBenchFn(...)
261- field ( "testfn" , test_fn ) , // }
262- ] ,
263- ) , // }
263+ // testfn: test::StaticTestFn(...) | test::StaticBenchFn(...)
264+ field ( "testfn" , test_fn ) , // }
265+ ] ,
266+ ) , // }
267+ ) ,
264268 ) ,
265269 ) ;
266270 test_const = test_const. map ( |mut tc| {
0 commit comments