@@ -3541,3 +3541,127 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
3541
3541
)
3542
3542
. run ( )
3543
3543
}
3544
+
3545
+ #[ cargo_test]
3546
+ fn normalize_paths ( ) {
3547
+ let p = project ( )
3548
+ . file (
3549
+ "Cargo.toml" ,
3550
+ r#"
3551
+ [package]
3552
+ name = "foo"
3553
+ version = "0.0.1"
3554
+ edition = "2015"
3555
+ description = "foo"
3556
+ documentation = "docs.rs/foo"
3557
+ authors = []
3558
+ readme = ".\\docs\\README.md"
3559
+ license-file = ".\\docs\\LICENSE"
3560
+ build = ".\\src\\build.rs"
3561
+
3562
+ [lib]
3563
+ path = ".\\src\\lib.rs"
3564
+
3565
+ [[bin]]
3566
+ name = "foo"
3567
+ path = ".\\src\\bin\\foo\\main.rs"
3568
+
3569
+ [[example]]
3570
+ name = "example_foo"
3571
+ path = ".\\examples\\example_foo.rs"
3572
+
3573
+ [[test]]
3574
+ name = "test_foo"
3575
+ path = ".\\tests\\test_foo.rs"
3576
+
3577
+ [[bench]]
3578
+ name = "bench_foo"
3579
+ path = ".\\benches\\bench_foo.rs"
3580
+ "# ,
3581
+ )
3582
+ . file ( "src/lib.rs" , "" )
3583
+ . file ( "docs/README.md" , "" )
3584
+ . file ( "docs/LICENSE" , "" )
3585
+ . file ( "src/build.rs" , "fn main() {}" )
3586
+ . file ( "src/bin/foo/main.rs" , "fn main() {}" )
3587
+ . file ( "examples/example_foo.rs" , "fn main() {}" )
3588
+ . file ( "tests/test_foo.rs" , "fn main() {}" )
3589
+ . file ( "benches/bench_foo.rs" , "fn main() {}" )
3590
+ . build ( ) ;
3591
+
3592
+ p. cargo ( "package" )
3593
+ . with_stdout ( "" )
3594
+ . with_stderr (
3595
+ "\
3596
+ [PACKAGING] foo v0.0.1 ([CWD])
3597
+ [VERIFYING] foo v0.0.1 ([CWD])
3598
+ [COMPILING] foo v0.0.1 ([CWD][..])
3599
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
3600
+ [PACKAGED] 11 files, [..] ([..] compressed)
3601
+ " ,
3602
+ )
3603
+ . run ( ) ;
3604
+
3605
+ let f = File :: open ( & p. root ( ) . join ( "target/package/foo-0.0.1.crate" ) ) . unwrap ( ) ;
3606
+ validate_crate_contents (
3607
+ f,
3608
+ "foo-0.0.1.crate" ,
3609
+ & [
3610
+ "Cargo.lock" ,
3611
+ "Cargo.toml" ,
3612
+ "Cargo.toml.orig" ,
3613
+ "src/lib.rs" ,
3614
+ "docs/README.md" ,
3615
+ "docs/LICENSE" ,
3616
+ "src/build.rs" ,
3617
+ "src/bin/foo/main.rs" ,
3618
+ "examples/example_foo.rs" ,
3619
+ "tests/test_foo.rs" ,
3620
+ "benches/bench_foo.rs" ,
3621
+ ] ,
3622
+ & [ (
3623
+ "Cargo.toml" ,
3624
+ r#"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
3625
+ #
3626
+ # When uploading crates to the registry Cargo will automatically
3627
+ # "normalize" Cargo.toml files for maximal compatibility
3628
+ # with all versions of Cargo and also rewrite `path` dependencies
3629
+ # to registry (e.g., crates.io) dependencies.
3630
+ #
3631
+ # If you are reading this file be aware that the original Cargo.toml
3632
+ # will likely look very different (and much more reasonable).
3633
+ # See Cargo.toml.orig for the original contents.
3634
+
3635
+ [package]
3636
+ edition = "2015"
3637
+ name = "foo"
3638
+ version = "0.0.1"
3639
+ authors = []
3640
+ build = './src/build.rs'
3641
+ description = "foo"
3642
+ documentation = "docs.rs/foo"
3643
+ readme = './docs/README.md'
3644
+ license-file = './docs/LICENSE'
3645
+
3646
+ [lib]
3647
+ path = './src/lib.rs'
3648
+
3649
+ [[bin]]
3650
+ name = "foo"
3651
+ path = './src/bin/foo/main.rs'
3652
+
3653
+ [[example]]
3654
+ name = "example_foo"
3655
+ path = './examples/example_foo.rs'
3656
+
3657
+ [[test]]
3658
+ name = "test_foo"
3659
+ path = './tests/test_foo.rs'
3660
+
3661
+ [[bench]]
3662
+ name = "bench_foo"
3663
+ path = './benches/bench_foo.rs'
3664
+ "# ,
3665
+ ) ] ,
3666
+ ) ;
3667
+ }
0 commit comments