Skip to content

Commit

Permalink
agent: resolve unused variables in tests
Browse files Browse the repository at this point in the history
A few tests have unused or unread variables. Let's clean these up...

Fixes: #3530
Signed-off-by: Eric Ernst <eric_ernst@apple.com>
  • Loading branch information
egernst committed Jan 16, 2022
1 parent 25aa2e8 commit 9277317
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
2 changes: 1 addition & 1 deletion src/agent/rustjail/src/mount.rs
Expand Up @@ -1385,7 +1385,7 @@ mod tests {

for (i, t) in tests.iter().enumerate() {
// Create a string containing details of the test
let msg = format!("test[{}]: {:?}", i, t);
let msg = format!("test[{}]: {:?}", i, t.name);

// if is_symlink, then should be prepare the softlink environment
if t.symlink_path != "" {
Expand Down
12 changes: 0 additions & 12 deletions src/agent/src/util.rs
Expand Up @@ -90,15 +90,13 @@ mod tests {
#[derive(Debug, Default, Clone)]
struct BufWriter {
data: Arc<Mutex<Vec<u8>>>,
slow_write: bool,
write_delay: Duration,
}

impl BufWriter {
fn new() -> Self {
BufWriter {
data: Arc::new(Mutex::new(Vec::<u8>::new())),
slow_write: false,
write_delay: Duration::new(0, 0),
}
}
Expand Down Expand Up @@ -179,45 +177,35 @@ mod tests {
#[derive(Debug)]
struct TestData {
reader_value: String,
result: io::Result<u64>,
}

let tests = &[
TestData {
reader_value: "".into(),
result: Ok(0),
},
TestData {
reader_value: "a".into(),
result: Ok(1),
},
TestData {
reader_value: "foo".into(),
result: Ok(3),
},
TestData {
reader_value: "b".repeat(BUF_SIZE - 1),
result: Ok((BUF_SIZE - 1) as u64),
},
TestData {
reader_value: "c".repeat(BUF_SIZE),
result: Ok((BUF_SIZE) as u64),
},
TestData {
reader_value: "d".repeat(BUF_SIZE + 1),
result: Ok((BUF_SIZE + 1) as u64),
},
TestData {
reader_value: "e".repeat((2 * BUF_SIZE) - 1),
result: Ok(((2 * BUF_SIZE) - 1) as u64),
},
TestData {
reader_value: "f".repeat(2 * BUF_SIZE),
result: Ok((2 * BUF_SIZE) as u64),
},
TestData {
reader_value: "g".repeat((2 * BUF_SIZE) + 1),
result: Ok(((2 * BUF_SIZE) + 1) as u64),
},
];

Expand Down

0 comments on commit 9277317

Please sign in to comment.