Skip to content

Commit

Permalink
fix: linter on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ecyrbe committed Mar 1, 2020
1 parent 12bc471 commit 8ca3bce
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions cli/priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ use winapi::um::winbase::{
REALTIME_PRIORITY_CLASS,
};
#[cfg(windows)]
use winapi::um::winnt::HANDLE;
#[cfg(windows)]
use winapi::um::winnt::PROCESS_QUERY_LIMITED_INFORMATION;
#[cfg(target_os = "macos")]
#[allow(non_camel_case_types)]
Expand Down Expand Up @@ -135,31 +133,25 @@ mod tests {
get_priority(0).expect("Should get priority");
}

/// these tests should be kept in max priority to lower priority
/// containers on ci/cd do not allow to increase priority
#[cfg(unix)]
#[test]
fn test_set_current_process_high_priority_should_fail() {
assert!(set_priority(0, PRIORITY_HIGH).is_err());
}

#[cfg(not(target_os = "macos"))]
/// this test makes multiple tests at once
/// because we need to set them in order and rust
/// does not gauaranty test order execution
#[test]
fn test_set_current_process_priority_to_normal() {
fn test_set_current_process_priority_from_normal_to_low() {
set_priority(0, PRIORITY_NORMAL).expect("Should set priority");
let priority = get_priority(0).expect("Should get priority");
assert_eq!(priority, PRIORITY_NORMAL);
}

#[test]
fn test_set_current_process_priority_to_below_normal() {
set_priority(0, PRIORITY_BELOW_NORMAL).expect("Should set priority");
let priority = get_priority(0).expect("Should get priority");
assert_eq!(priority, PRIORITY_BELOW_NORMAL);
}

#[test]
fn test_set_current_process_priority_to_low() {
set_priority(0, PRIORITY_LOW).expect("Should set priority");
let priority = get_priority(0).expect("Should get priority");
assert_eq!(priority, PRIORITY_LOW);
Expand Down

0 comments on commit 8ca3bce

Please sign in to comment.