File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -403,3 +403,43 @@ fn build_script_extra_link_arg_examples() {
403
403
)
404
404
. run ( ) ;
405
405
}
406
+
407
+ #[ cargo_test]
408
+ fn cdylib_both_forms ( ) {
409
+ // Cargo accepts two different forms for the cdylib link instruction,
410
+ // which have the same meaning.
411
+ let p = project ( )
412
+ . file (
413
+ "Cargo.toml" ,
414
+ r#"
415
+ [package]
416
+ name = "foo"
417
+ version = "0.1.0"
418
+ edition = "2015"
419
+
420
+ [lib]
421
+ crate-type = ["cdylib"]
422
+ "# ,
423
+ )
424
+ . file ( "src/lib.rs" , "" )
425
+ . file (
426
+ "build.rs" ,
427
+ r#"
428
+ fn main() {
429
+ println!("cargo::rustc-cdylib-link-arg=--bogus-flag-one");
430
+ println!("cargo::rustc-link-arg-cdylib=--bogus-flag-two");
431
+ }
432
+ "# ,
433
+ )
434
+ . build ( ) ;
435
+ p. cargo ( "build -v" )
436
+ . without_status ( )
437
+ . with_stderr_data ( str![ [ r#"
438
+ [COMPILING] foo v0.1.0 ([ROOT]/foo)
439
+ [RUNNING] `rustc --crate-name build_script_build [..]
440
+ [RUNNING] `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build`
441
+ [RUNNING] `rustc --crate-name foo [..]--crate-type cdylib [..]-C link-arg=--bogus-flag-one -C link-arg=--bogus-flag-two[..]
442
+ ...
443
+ "# ] ] )
444
+ . run ( ) ;
445
+ }
You can’t perform that action at this time.
0 commit comments