From 16899f8c23834df950f8777c5b921309ff16db3b Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 May 2017 15:41:16 +0100 Subject: [PATCH] rsm: Add a test for . --- src/rsm.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/rsm.rs b/src/rsm.rs index a6aec04d..7e139feb 100644 --- a/src/rsm.rs +++ b/src/rsm.rs @@ -180,4 +180,25 @@ mod tests { let elem2 = (&rsm).into(); assert_eq!(elem, elem2); } + + #[test] + fn test_first_index() { + let elem: Element = "coucou".parse().unwrap(); + let set = Set::try_from(&elem).unwrap(); + assert_eq!(set.first, Some(String::from("coucou"))); + assert_eq!(set.first_index, Some(4)); + + let set2 = Set { + after: None, + before: None, + count: None, + first: Some(String::from("coucou")), + first_index: Some(4), + index: None, + last: None, + max: None, + }; + let elem2 = (&set2).into(); + assert_eq!(elem, elem2); + } }