Skip to content

Commit a512487

Browse files
0xPoeTurbo87
authored andcommitted
Add empty feature name test and rename tests
invalid_feature and invalid_feature_name both for test invalid feature name. So we can use the same prefix for them. Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent 2f8db06 commit a512487

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

src/tests/krate/publish/features.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ fn feature_name_with_dot() {
3535
}
3636

3737
#[test]
38-
fn invalid_feature_name() {
38+
fn empty_feature_name() {
39+
let (app, _, _, token) = TestApp::full().with_token();
40+
let crate_to_publish = PublishBuilder::new("foo", "1.0.0").feature("", &[]);
41+
let response = token.publish_crate(crate_to_publish);
42+
assert_eq!(response.status(), StatusCode::OK);
43+
assert_json_snapshot!(response.into_json());
44+
assert!(app.stored_files().is_empty());
45+
}
46+
47+
#[test]
48+
fn invalid_feature_name1() {
3949
let (app, _, _, token) = TestApp::full().with_token();
4050

4151
let crate_to_publish = PublishBuilder::new("foo", "1.0.0").feature("~foo", &[]);
@@ -46,7 +56,7 @@ fn invalid_feature_name() {
4656
}
4757

4858
#[test]
49-
fn invalid_feature() {
59+
fn invalid_feature_name2() {
5060
let (app, _, _, token) = TestApp::full().with_token();
5161

5262
let crate_to_publish = PublishBuilder::new("foo", "1.0.0").feature("foo", &["!bar"]);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
source: src/tests/krate/publish/features.rs
3+
expression: response.into_json()
4+
---
5+
{
6+
"errors": [
7+
{
8+
"detail": "feature cannot be an empty"
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)