last: adapt test to fix "unused import" warnings
This commit is contained in:
@@ -9,8 +9,6 @@ use crate::common::util::TestScenario;
|
||||
|
||||
#[cfg(unix)]
|
||||
use regex::Regex;
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
@@ -95,19 +93,18 @@ fn test_timestamp_format_iso() {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_short_invalid_utmp_file() {
|
||||
let filepath = "/tmp/testfile";
|
||||
let testfile = fs::File::create(filepath);
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "testfile";
|
||||
// Random bytes
|
||||
let data: Vec<u8> = vec![
|
||||
let data = [
|
||||
4, 5, 6, 16, 8, 13, 2, 12, 5, 3, 11, 5, 1, 13, 1, 1, 0, 9, 5, 5, 2, 8, 4,
|
||||
];
|
||||
let _ = testfile.unwrap().write_all(&data);
|
||||
at.write_bytes(file, &data);
|
||||
|
||||
let regex = Regex::new(r"\n\S*\sbegins\s*(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s*[0-9][0-9]?\s*[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\s*[0-9]*")
|
||||
.unwrap();
|
||||
|
||||
new_ucmd!()
|
||||
.arg(format!("--file={filepath}"))
|
||||
ucmd.arg(format!("--file={file}"))
|
||||
.succeeds()
|
||||
.stdout_matches(®ex);
|
||||
}
|
||||
|
Reference in New Issue
Block a user