use pretty_assertions::assert_eq;
use super::prompt_history_items;
#[test]
fn rows_are_newest_first_without_repeats() {
let history = [
"fix the build",
"run tests\n again",
"fix the build",
"ship it",
]
.map(String::from);
let rows = prompt_history_items(&history)
.into_iter()
.map(|item| (item.label, item.value))
.collect::<Vec<_>>();
assert_eq!(
rows,
[
("ship it", "ship it"),
("fix the build", "fix the build"),
("run tests again", "run tests\n again"),
]
.map(|(label, value)| (label.to_string(), value.to_string()))
);
}