Skip to content

Commit 4f68299

Browse files
committed
fix(test)!: Clarify purpose of Package::invalid_index_line
1 parent 9a8ca86 commit 4f68299

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

crates/cargo-test-support/src/registry.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ pub struct Package {
570570
features: FeatureMap,
571571
local: bool,
572572
alternative: bool,
573-
invalid_json: bool,
573+
invalid_index_line: bool,
574574
edition: Option<String>,
575575
resolver: Option<String>,
576576
proc_macro: bool,
@@ -1251,7 +1251,7 @@ impl Package {
12511251
features: BTreeMap::new(),
12521252
local: false,
12531253
alternative: false,
1254-
invalid_json: false,
1254+
invalid_index_line: false,
12551255
edition: None,
12561256
resolver: None,
12571257
proc_macro: false,
@@ -1422,8 +1422,8 @@ impl Package {
14221422

14231423
/// Causes the JSON line emitted in the index to be invalid, presumably
14241424
/// causing Cargo to skip over this version.
1425-
pub fn invalid_json(&mut self, invalid: bool) -> &mut Package {
1426-
self.invalid_json = invalid;
1425+
pub fn invalid_index_line(&mut self, invalid: bool) -> &mut Package {
1426+
self.invalid_index_line = invalid;
14271427
self
14281428
}
14291429

@@ -1496,7 +1496,7 @@ impl Package {
14961496
let c = t!(fs::read(&self.archive_dst()));
14971497
cksum(&c)
14981498
};
1499-
let name = if self.invalid_json {
1499+
let name = if self.invalid_index_line {
15001500
serde_json::json!(1)
15011501
} else {
15021502
serde_json::json!(self.name)

tests/testsuite/registry.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2916,7 +2916,9 @@ fn ignore_invalid_json_lines_git() {
29162916

29172917
fn ignore_invalid_json_lines() {
29182918
Package::new("foo", "0.1.0").publish();
2919-
Package::new("foo", "0.1.1").invalid_json(true).publish();
2919+
Package::new("foo", "0.1.1")
2920+
.invalid_index_line(true)
2921+
.publish();
29202922
Package::new("foo", "0.2.0").publish();
29212923

29222924
let p = project()

0 commit comments

Comments
 (0)