Skip to content

Commit 0846b8e

Browse files
committed
refactor(tests): Document case outside the test, rather than in
This will make it easier to document some of the lines of code
1 parent e691e18 commit 0846b8e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/testsuite/publish.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ See [..]
133133
validate_upload_foo();
134134
}
135135

136+
// Check that the `token` key works at the root instead of under a
137+
// `[registry]` table.
136138
#[cargo_test]
137139
fn old_token_location() {
138-
// Check that the `token` key works at the root instead of under a
139-
// `[registry]` table.
140140
let registry = registry::init();
141141

142142
let p = project()
@@ -787,9 +787,9 @@ The registry `alternative` is not listed in the `publish` value in Cargo.toml.
787787
.run();
788788
}
789789

790+
// Explicitly setting `crates-io` in the publish list.
790791
#[cargo_test]
791792
fn publish_with_crates_io_explicit() {
792-
// Explicitly setting `crates-io` in the publish list.
793793
let registry = registry::init();
794794

795795
let p = project()
@@ -1100,10 +1100,10 @@ include `--registry crates-io` to use crates.io
11001100
.run();
11011101
}
11021102

1103+
// A dependency with both `git` and `version`.
11031104
#[cargo_test]
11041105
fn publish_git_with_version() {
11051106
let registry = registry::init();
1106-
// A dependency with both `git` and `version`.
11071107
Package::new("dep1", "1.0.1")
11081108
.file("src/lib.rs", "pub fn f() -> i32 {1}")
11091109
.publish();
@@ -1345,10 +1345,10 @@ fn credentials_ambiguous_filename() {
13451345
validate_upload_foo();
13461346
}
13471347

1348+
// --index will not load registry.token to avoid possibly leaking
1349+
// crates.io token to another server.
13481350
#[cargo_test]
13491351
fn index_requires_token() {
1350-
// --index will not load registry.token to avoid possibly leaking
1351-
// crates.io token to another server.
13521352
let registry = registry::init();
13531353
let credentials = paths::home().join(".cargo/credentials");
13541354
fs::remove_file(&credentials).unwrap();
@@ -1380,9 +1380,9 @@ fn index_requires_token() {
13801380
.run();
13811381
}
13821382

1383+
// publish with source replacement without --registry
13831384
#[cargo_test]
13841385
fn cratesio_source_replacement() {
1385-
// publish with source replacement without --registry
13861386
registry::init();
13871387
let p = project()
13881388
.file(
@@ -1451,9 +1451,9 @@ Caused by:
14511451
.run();
14521452
}
14531453

1454+
// Registry returns an API error.
14541455
#[cargo_test]
14551456
fn api_error_json() {
1456-
// Registry returns an API error.
14571457
let _registry = registry::RegistryBuilder::new()
14581458
.alternative()
14591459
.http_api()
@@ -1498,9 +1498,9 @@ Caused by:
14981498
.run();
14991499
}
15001500

1501+
// Registry returns an API error with a 200 status code.
15011502
#[cargo_test]
15021503
fn api_error_200() {
1503-
// Registry returns an API error with a 200 status code.
15041504
let _registry = registry::RegistryBuilder::new()
15051505
.alternative()
15061506
.http_api()
@@ -1545,9 +1545,9 @@ Caused by:
15451545
.run();
15461546
}
15471547

1548+
// Registry returns an error code without a JSON message.
15481549
#[cargo_test]
15491550
fn api_error_code() {
1550-
// Registry returns an error code without a JSON message.
15511551
let _registry = registry::RegistryBuilder::new()
15521552
.alternative()
15531553
.http_api()
@@ -1598,9 +1598,9 @@ Caused by:
15981598
.run();
15991599
}
16001600

1601+
// Registry has a network error.
16011602
#[cargo_test]
16021603
fn api_curl_error() {
1603-
// Registry has a network error.
16041604
let _registry = registry::RegistryBuilder::new()
16051605
.alternative()
16061606
.http_api()
@@ -1647,9 +1647,9 @@ Caused by:
16471647
.run();
16481648
}
16491649

1650+
// Registry returns an invalid response.
16501651
#[cargo_test]
16511652
fn api_other_error() {
1652-
// Registry returns an invalid response.
16531653
let _registry = registry::RegistryBuilder::new()
16541654
.alternative()
16551655
.http_api()

0 commit comments

Comments
 (0)