Extract the file to lines function
This commit is contained in:
parent
9420cb5c18
commit
29fadfaa4b
|
@ -291,6 +291,15 @@ mod tests {
|
||||||
Fail,
|
Fail,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn lines_from_file(file: File) -> Vec<String> {
|
||||||
|
BufReader::new(file)
|
||||||
|
.lines()
|
||||||
|
.into_iter()
|
||||||
|
.filter(|line| line.is_ok())
|
||||||
|
.map(|line| line.unwrap())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
fn assert_run(res: Result<File, File>, expected: Expect, require: Vec<&str>) {
|
fn assert_run(res: Result<File, File>, expected: Expect, require: Vec<&str>) {
|
||||||
let expectation_held: bool = match expected {
|
let expectation_held: bool = match expected {
|
||||||
Expect::Pass => res.is_ok(),
|
Expect::Pass => res.is_ok(),
|
||||||
|
@ -302,12 +311,7 @@ mod tests {
|
||||||
Err(file) => file,
|
Err(file) => file,
|
||||||
};
|
};
|
||||||
|
|
||||||
let lines: Vec<String> = BufReader::new(file)
|
let lines = lines_from_file(file);
|
||||||
.lines()
|
|
||||||
.into_iter()
|
|
||||||
.filter(|line| line.is_ok())
|
|
||||||
.map(|line| line.unwrap())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let buildlog = lines
|
let buildlog = lines
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
Loading…
Reference in a new issue