@@ -272,21 +272,20 @@ mod test_expand {
272
272
273
273
use super :: * ;
274
274
275
- macro_rules! si {
276
- ( $i: expr) => { {
277
- let shell = crate :: Shell :: from_write( Box :: new( Vec :: new( ) ) ) ;
278
- let cwd = std:: env:: current_dir( ) . unwrap( ) ;
279
- let home = home:: cargo_home_with_cwd( & cwd) . unwrap( ) ;
280
- let gctx = GlobalContext :: new( shell, cwd, home) ;
281
- expand_manifest( $i, std:: path:: Path :: new( "/home/me/test.rs" ) , & gctx)
282
- . unwrap_or_else( |err| panic!( "{}" , err) )
283
- } } ;
275
+ #[ track_caller]
276
+ fn expand ( source : & str ) -> String {
277
+ let shell = crate :: Shell :: from_write ( Box :: new ( Vec :: new ( ) ) ) ;
278
+ let cwd = std:: env:: current_dir ( ) . unwrap ( ) ;
279
+ let home = home:: cargo_home_with_cwd ( & cwd) . unwrap ( ) ;
280
+ let gctx = GlobalContext :: new ( shell, cwd, home) ;
281
+ expand_manifest ( source, std:: path:: Path :: new ( "/home/me/test.rs" ) , & gctx)
282
+ . unwrap_or_else ( |err| panic ! ( "{}" , err) )
284
283
}
285
284
286
285
#[ test]
287
286
fn test_default ( ) {
288
287
assert_data_eq ! (
289
- si! ( r#"fn main() {}"# ) ,
288
+ expand ( r#"fn main() {}"# ) ,
290
289
str ![ [ r#"
291
290
[[bin]]
292
291
name = "test-"
@@ -314,12 +313,14 @@ strip = true
314
313
#[ test]
315
314
fn test_dependencies ( ) {
316
315
assert_data_eq ! (
317
- si!( r#"---cargo
316
+ expand(
317
+ r#"---cargo
318
318
[dependencies]
319
319
time="0.1.25"
320
320
---
321
321
fn main() {}
322
- "# ) ,
322
+ "#
323
+ ) ,
323
324
str ![ [ r#"
324
325
[[bin]]
325
326
name = "test-"
@@ -350,12 +351,14 @@ strip = true
350
351
#[ test]
351
352
fn test_no_infostring ( ) {
352
353
assert_data_eq ! (
353
- si!( r#"---
354
+ expand(
355
+ r#"---
354
356
[dependencies]
355
357
time="0.1.25"
356
358
---
357
359
fn main() {}
358
- "# ) ,
360
+ "#
361
+ ) ,
359
362
str ![ [ r#"
360
363
[[bin]]
361
364
name = "test-"
0 commit comments