Skip to content

Commit

Permalink
adjust tests to match new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
m12t committed Feb 13, 2025
1 parent 1b43a67 commit 7f6ecca
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,19 +482,19 @@ mod tests {
app.items.lock().unwrap().push(prog_2.clone());

// Initially no item is selected
assert_eq!(app.selected_program(), None);
assert_eq!(app.selected_program(), None, "expected no program");

// After calling next, the first item should be selected
app.next_program();
assert_eq!(app.selected_program(), Some(prog_1.clone()));
assert_eq!(app.selected_program(), Some(prog_1.clone()), "expected prog_1");

// After calling next again, the second item should be selected
app.next_program();
assert_eq!(app.selected_program(), Some(prog_2.clone()));
assert_eq!(app.selected_program(), Some(prog_2.clone()), "expected prog_2");

// After calling next again, we should wrap around to the first item
app.next_program();
assert_eq!(app.selected_program(), Some(prog_1.clone()));
assert_eq!(app.selected_program(), Some(prog_2.clone()), "expected prog_2; no wrap around");
}

#[test]
Expand Down Expand Up @@ -543,19 +543,19 @@ mod tests {
app.items.lock().unwrap().push(prog_2.clone());

// Initially no item is selected
assert_eq!(app.selected_program(), None);
assert_eq!(app.selected_program(), None, "expected no program");

// After calling previous, the last item should be selected
app.previous_program();
assert_eq!(app.selected_program(), Some(prog_2.clone()));
assert_eq!(app.selected_program(), Some(prog_1.clone()), "expected prog_1");

// After calling previous again, the first item should be selected
app.previous_program();
assert_eq!(app.selected_program(), Some(prog_1.clone()));
assert_eq!(app.selected_program(), Some(prog_1.clone()), "still prog_1");

// After calling previous again, we should wrap around to the last item
app.previous_program();
assert_eq!(app.selected_program(), Some(prog_2.clone()));
assert_eq!(app.selected_program(), Some(prog_1.clone()), "still expecting prog_1");
}

#[test]
Expand Down

0 comments on commit 7f6ecca

Please sign in to comment.