More OsSplit testing
@@ -188,6 +188,8 @@ impl Iterator for OsSplit {
#[test]
fn os_split_none() {
let os = OsString::from("");
+ assert_eq!(os.split(b',').collect::<Vec<OsString>>(), Vec::<OsString>::new());
+
let mut split = os.split(b',');
assert_eq!(split.next(), None);
}
@@ -196,6 +198,8 @@ fn os_split_none() {
#[test]
fn os_split_one() {
let os = OsString::from("abc");
+ assert_eq!(os.split(b',').collect::<Vec<OsString>>(), vec![OsString::from("abc")]);
+
let mut split = os.split(b',');
assert_eq!(split.next(), Some(OsString::from("abc")));
assert_eq!(split.next(), None);
@@ -205,6 +209,12 @@ fn os_split_one() {
#[test]
fn os_split_multi() {
let os = OsString::from("a,b,c");
+ assert_eq!(os.split(b',').collect::<Vec<OsString>>(), vec![
+ OsString::from("a"),
+ OsString::from("b"),
+ OsString::from("c"),
+ ]);
+
let mut split = os.split(b',');
assert_eq!(split.next(), Some(OsString::from("a")));
assert_eq!(split.next(), Some(OsString::from("b")));
@@ -216,6 +226,13 @@ fn os_split_multi() {
#[test]
fn os_split_leading() {
let os = OsString::from(",a,b,c");
+ assert_eq!(os.split(b',').collect::<Vec<OsString>>(), vec![
+ OsString::from(""),
+ OsString::from("a"),
+ OsString::from("b"),
+ OsString::from("c"),
+ ]);
+
let mut split = os.split(b',');
assert_eq!(split.next(), Some(OsString::from("")));
assert_eq!(split.next(), Some(OsString::from("a")));
