Skip to content

Commit 933fa40

Browse files
committed
test(check): Added regression test for check build dylib uplifting
1 parent a261f5a commit 933fa40

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

tests/testsuite/check.rs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,3 +1718,88 @@ fn check_build_should_not_lock_artifact_dir() {
17181718
p.cargo("check").enable_mac_dsym().run();
17191719
assert!(!p.root().join("target/debug/.cargo-lock").exists());
17201720
}
1721+
1722+
// Regression test for #16305
1723+
#[should_panic]
1724+
#[cargo_test]
1725+
fn check_build_should_uplift_proc_macro_dylib_deps() {
1726+
let p = project()
1727+
.file(
1728+
".cargo/config.toml",
1729+
r#"
1730+
[build]
1731+
target-dir = "target-dir"
1732+
build-dir = "build-dir"
1733+
"#,
1734+
)
1735+
.file(
1736+
"Cargo.toml",
1737+
r#"
1738+
[workspace]
1739+
members = ["foo", "bar", "baz"]
1740+
"#,
1741+
)
1742+
// Bin
1743+
.file(
1744+
"foo/Cargo.toml",
1745+
r#"
1746+
[package]
1747+
name = "foo"
1748+
version = "0.0.1"
1749+
edition = "2015"
1750+
1751+
[dependencies]
1752+
bar = { path = "../bar" }
1753+
"#,
1754+
)
1755+
.file("foo/src/main.rs", "fn main() {}")
1756+
// Proc macro
1757+
.file(
1758+
"bar/Cargo.toml",
1759+
r#"
1760+
[package]
1761+
name = "bar"
1762+
version = "0.0.1"
1763+
edition = "2015"
1764+
1765+
[lib]
1766+
proc-macro = true
1767+
1768+
[dependencies]
1769+
baz = { path = "../baz" }
1770+
"#,
1771+
)
1772+
.file(
1773+
"bar/src/lib.rs",
1774+
r#"
1775+
extern crate proc_macro;
1776+
1777+
use proc_macro::TokenStream;
1778+
1779+
#[proc_macro_derive(B)]
1780+
pub fn derive(input: TokenStream) -> TokenStream {
1781+
input
1782+
}
1783+
"#,
1784+
)
1785+
// Dylib
1786+
.file(
1787+
"baz/Cargo.toml",
1788+
r#"
1789+
[package]
1790+
name = "baz"
1791+
version = "0.1.0"
1792+
edition = "2015"
1793+
authors = []
1794+
1795+
[lib]
1796+
crate-type = ["dylib"]
1797+
1798+
[dependencies]
1799+
"#,
1800+
)
1801+
.file("baz/src/lib.rs", "pub fn baz() { }")
1802+
.build();
1803+
1804+
p.cargo("check").enable_mac_dsym().run();
1805+
}

0 commit comments

Comments
 (0)