aboutsummaryrefslogtreecommitdiff
path: root/src/tw
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2017-11-26 22:06:02 -0800
committeriximeow <me@iximeow.net>2017-11-26 22:06:02 -0800
commitb00842a60e85825814b4f1e48e0f222024ae9519 (patch)
tree3cbeb2196dd01290469365bc89686b40960796e1 /src/tw
parent983f073965024770f70ab29611f593c961499653 (diff)
wrap lines intelligently with respect to ANSI sequences
Diffstat (limited to 'src/tw')
-rw-r--r--src/tw/mod.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/tw/mod.rs b/src/tw/mod.rs
index ee3b73e..629a6c7 100644
--- a/src/tw/mod.rs
+++ b/src/tw/mod.rs
@@ -178,17 +178,19 @@ mod tests {
use super::*;
#[test]
fn tweet_id_parse_test() {
- assert_eq!(TweetId::parse("12345".to_string()), Some(TweetId::Today(12345)));
- assert_eq!(TweetId::parse("20170403:12345".to_string()), Some(TweetId::Dated("20170403".to_string(), 12345)));
- assert_eq!(TweetId::parse(":12345".to_string()), Some(TweetId::Bare(12345)));
- assert_eq!(TweetId::parse("twitter:12345".to_string()), Some(TweetId::Twitter("12345".to_string())));
- assert_eq!(TweetId::parse("twitter:asdf".to_string()), Some(TweetId::Twitter("asdf".to_string())));
- assert_eq!(TweetId::parse("a2345".to_string()), None);
- assert_eq!(TweetId::parse(":".to_string()), None);
- assert_eq!(TweetId::parse("::".to_string()), None);
- assert_eq!(TweetId::parse("a:13234".to_string()), None);
- assert_eq!(TweetId::parse(":a34".to_string()), None);
- assert_eq!(TweetId::parse("asdf:34".to_string()), None);
+ assert_eq!(TweetId::parse("12345".to_string()), Ok(TweetId::Today(12345)));
+ assert_eq!(TweetId::parse("20170403:12345".to_string()), Ok(TweetId::Dated("20170403".to_string(), 12345)));
+ assert_eq!(TweetId::parse(":12345".to_string()), Ok(TweetId::Bare(12345)));
+ assert_eq!(TweetId::parse("twitter:12345".to_string()), Ok(TweetId::Twitter("12345".to_string())));
+ assert_eq!(TweetId::parse("twitter:asdf".to_string()), Ok(TweetId::Twitter("asdf".to_string())));
+ assert_eq!(TweetId::parse("a2345".to_string()), Err("Unrecognized id string: a2345".to_owned()));
+ // TODO: clarify
+ assert_eq!(TweetId::parse(":".to_string()), Err("cannot parse integer from empty string".to_owned()));
+ // TODO: clarify
+ assert_eq!(TweetId::parse("::".to_string()), Err("invalid digit found in string".to_owned()));
+ assert_eq!(TweetId::parse("a:13234".to_string()), Err("Unrecognized id string: a:13234".to_owned()));
+ assert_eq!(TweetId::parse(":a34".to_string()), Err("invalid digit found in string".to_owned()));
+ assert_eq!(TweetId::parse("asdf:34".to_string()), Err("Unrecognized id string: asdf:34".to_owned()));
}
}