Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
gshuflin committed Jun 21, 2019
1 parent 24ff3bb commit a104c46
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/rust/engine/process_execution/src/lib.rs
Expand Up @@ -158,3 +158,39 @@ impl CommandRunner for BoundedCommandRunner {
self.inner.1.with_acquired(move || inner.0.run(req))
}
}

#[cfg(test)]
mod tests {
use super::ExecuteProcessRequest;
use std::collections::hash_map::DefaultHasher;
use std::collections::{BTreeMap, BTreeSet};
use std::hash::Hash;

#[test]
fn execute_process_request_equality() {
let a = ExecuteProcessRequest {
argv: vec![],
env: BTreeMap::new(),
input_files: hashing::EMPTY_DIGEST,
output_files: BTreeSet::new(),
output_directories: BTreeSet::new(),
timeout: std::time::Duration::new(0, 0),
description: format!("One message"),
jdk_home: None,
};

let b = ExecuteProcessRequest {
argv: vec![],
env: BTreeMap::new(),
input_files: hashing::EMPTY_DIGEST,
output_files: BTreeSet::new(),
output_directories: BTreeSet::new(),
timeout: std::time::Duration::new(0, 0),
description: format!("Different message"),
jdk_home: None,
};
assert!(a == b);
let mut hasher = DefaultHasher::new();
assert!(a.hash(&mut hasher) == b.hash(&mut hasher));
}
}

0 comments on commit a104c46

Please sign in to comment.