Skip to content

Commit 3307176

Browse files
committed
tests: profile_custom - add name validation tests
1 parent cdd85cc commit 3307176

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

tests/testsuite/profile_custom.rs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,109 @@ Caused by:
6767
.run();
6868
}
6969

70+
#[cargo_test]
71+
fn invalid_profile_name() {
72+
let p = project()
73+
.file(
74+
"Cargo.toml",
75+
r#"
76+
cargo-features = ["named-profiles"]
77+
78+
[package]
79+
name = "foo"
80+
version = "0.0.1"
81+
authors = []
82+
83+
[profile.'.release-lto']
84+
inherits = "release"
85+
codegen-units = 7
86+
"#,
87+
)
88+
.file("src/lib.rs", "")
89+
.build();
90+
91+
p.cargo("build")
92+
.masquerade_as_nightly_cargo()
93+
.with_status(101)
94+
.with_stderr(
95+
"\
96+
[ERROR] failed to parse manifest at [..]
97+
98+
Caused by:
99+
Invalid character `.` in profile name: `.release-lto`",
100+
)
101+
.run();
102+
}
103+
104+
#[cargo_test]
105+
fn invalid_dir_name() {
106+
let p = project()
107+
.file(
108+
"Cargo.toml",
109+
r#"
110+
cargo-features = ["named-profiles"]
111+
112+
[package]
113+
name = "foo"
114+
version = "0.0.1"
115+
authors = []
116+
117+
[profile.'release-lto']
118+
inherits = "release"
119+
dir-name = ".subdir"
120+
codegen-units = 7
121+
"#,
122+
)
123+
.file("src/lib.rs", "")
124+
.build();
125+
126+
p.cargo("build")
127+
.masquerade_as_nightly_cargo()
128+
.with_status(101)
129+
.with_stderr(
130+
"\
131+
[ERROR] failed to parse manifest at [..]
132+
133+
Caused by:
134+
Invalid character `.` in dir-name: `.subdir`",
135+
)
136+
.run();
137+
}
138+
139+
#[cargo_test]
140+
fn invalid_inherits() {
141+
let p = project()
142+
.file(
143+
"Cargo.toml",
144+
r#"
145+
cargo-features = ["named-profiles"]
146+
147+
[package]
148+
name = "foo"
149+
version = "0.0.1"
150+
authors = []
151+
152+
[profile.'release-lto']
153+
inherits = ".release"
154+
codegen-units = 7
155+
"#,
156+
)
157+
.file("src/lib.rs", "")
158+
.build();
159+
160+
p.cargo("build")
161+
.masquerade_as_nightly_cargo()
162+
.with_status(101)
163+
.with_stderr(
164+
"\
165+
[ERROR] failed to parse manifest at [..]
166+
167+
Caused by:
168+
Invalid character `.` in inherits: `.release`",
169+
)
170+
.run();
171+
}
172+
70173
#[cargo_test]
71174
fn non_existent_inherits() {
72175
let p = project()

0 commit comments

Comments
 (0)