aboutsummaryrefslogtreecommitdiff
path: root/src/tw/mod.rs
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-26 22:06:02 -0800
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-26 22:06:02 -0800
commitd193f2bc3dd883851f9149f1564a6d1904525914 (patch)
tree3cbeb2196dd01290469365bc89686b40960796e1 /src/tw/mod.rs
parente4925f0311574cd954909695bb587902179f8680 (diff)
wrap lines intelligently with respect to ANSI sequences
Diffstat (limited to 'src/tw/mod.rs')
-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()));
}
}