add Hint accessors

This commit is contained in:
Simon Gardling
2022-05-16 13:28:23 -04:00
parent 491c8eb6fb
commit c7e8865d7e
3 changed files with 37 additions and 3 deletions

View File

@@ -273,3 +273,18 @@ fn get_last_term() {
);
}
}
#[test]
fn hint_accessor() {
assert_eq!(Hint::Single("hint").many(), None);
assert_eq!(Hint::Single("hint").single(), Some(&"hint"));
assert_eq!(Hint::Many(&["hint", "hint2"]).single(), None);
assert_eq!(
Hint::Many(&["hint", "hint2"]).many(),
Some(&["hint", "hint2"].as_slice())
);
assert_eq!(Hint::None.single(), None);
assert_eq!(Hint::None.many(), None);
}