Skip to content

Commit b179cd1

Browse files
committed
review and remove ignored tests in rustfix
* reduce time in proptest * delete edition dir * remove refs to fixmode::EDITION
1 parent 463f307 commit b179cd1

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

crates/rustfix/src/replace.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,16 @@ mod tests {
312312

313313
proptest! {
314314
#[test]
315-
#[ignore]
316315
fn new_to_vec_roundtrip(ref s in "\\PC*") {
317316
assert_eq!(s.as_bytes(), Data::new(s.as_bytes()).to_vec().as_slice());
318317
}
319318

320319
#[test]
321-
#[ignore]
322320
fn replace_random_chunks(
323321
ref data in "\\PC*",
324322
ref replacements in prop::collection::vec(
325323
(any::<::std::ops::Range<usize>>(), any::<Vec<u8>>()),
326-
1..1337,
324+
1..100,
327325
)
328326
) {
329327
let mut d = Data::new(data.as_bytes());

crates/rustfix/tests/edition/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

crates/rustfix/tests/parse_and_replace.rs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use tracing::{debug, info, warn};
1414

1515
mod fixmode {
1616
pub const EVERYTHING: &str = "yolo";
17-
pub const EDITION: &str = "edition";
1817
}
1918

2019
mod settings {
@@ -24,10 +23,10 @@ mod settings {
2423
pub const RECORD_FIXED_RUST: &str = "RUSTFIX_TEST_RECORD_FIXED_RUST";
2524
}
2625

27-
fn compile(file: &Path, mode: &str) -> Result<Output, Error> {
26+
fn compile(file: &Path) -> Result<Output, Error> {
2827
let tmp = tempdir()?;
2928

30-
let mut args: Vec<OsString> = vec![
29+
let args: Vec<OsString> = vec![
3130
file.into(),
3231
"--error-format=json".into(),
3332
"--emit=metadata".into(),
@@ -36,10 +35,6 @@ fn compile(file: &Path, mode: &str) -> Result<Output, Error> {
3635
tmp.path().into(),
3736
];
3837

39-
if mode == fixmode::EDITION {
40-
args.push("--edition=2018".into());
41-
}
42-
4338
let res = Command::new(env::var_os("RUSTC").unwrap_or("rustc".into()))
4439
.args(&args)
4540
.env("CLIPPY_DISABLE_DOCS_LINKS", "true")
@@ -49,8 +44,8 @@ fn compile(file: &Path, mode: &str) -> Result<Output, Error> {
4944
Ok(res)
5045
}
5146

52-
fn compile_and_get_json_errors(file: &Path, mode: &str) -> Result<String, Error> {
53-
let res = compile(file, mode)?;
47+
fn compile_and_get_json_errors(file: &Path) -> Result<String, Error> {
48+
let res = compile(file)?;
5449
let stderr = String::from_utf8(res.stderr)?;
5550
if stderr.contains("is only accepted on the nightly compiler") {
5651
panic!("rustfix tests require a nightly compiler");
@@ -66,8 +61,8 @@ fn compile_and_get_json_errors(file: &Path, mode: &str) -> Result<String, Error>
6661
}
6762
}
6863

69-
fn compiles_without_errors(file: &Path, mode: &str) -> Result<(), Error> {
70-
let res = compile(file, mode)?;
64+
fn compiles_without_errors(file: &Path) -> Result<(), Error> {
65+
let res = compile(file)?;
7166

7267
match res.status.code() {
7368
Some(0) => Ok(()),
@@ -140,8 +135,8 @@ fn test_rustfix_with_file<P: AsRef<Path>>(file: P, mode: &str) -> Result<(), Err
140135

141136
debug!("next up: {:?}", file);
142137
let code = read_file(file).context(format!("could not read {}", file.display()))?;
143-
let errors = compile_and_get_json_errors(file, mode)
144-
.context(format!("could compile {}", file.display()))?;
138+
let errors =
139+
compile_and_get_json_errors(file).context(format!("could compile {}", file.display()))?;
145140
let suggestions =
146141
rustfix::get_suggestions_from_json(&errors, &HashSet::new(), filter_suggestions)
147142
.context("could not load suggestions")?;
@@ -191,7 +186,7 @@ fn test_rustfix_with_file<P: AsRef<Path>>(file: P, mode: &str) -> Result<(), Err
191186
diff(fixed.trim(), expected_fixed.trim())
192187
);
193188

194-
compiles_without_errors(&fixed_file, mode)?;
189+
compiles_without_errors(&fixed_file)?;
195190

196191
Ok(())
197192
}
@@ -238,10 +233,3 @@ fn everything() {
238233
tracing_subscriber::fmt::init();
239234
assert_fixtures("./tests/everything", fixmode::EVERYTHING);
240235
}
241-
242-
#[test]
243-
#[ignore = "Requires custom rustc build"]
244-
fn edition() {
245-
tracing_subscriber::fmt::init();
246-
assert_fixtures("./tests/edition", fixmode::EDITION);
247-
}

0 commit comments

Comments
 (0)