summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-12-20 11:46:02 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-12-20 11:48:02 +0100
commited93f2e071d82f49efa5434468bbc3271c49627b (patch)
tree3b8e89822f04be34fb9265936b98609f7d52e6ed
parentbcd54934a707e8bdc3a125d56307d19856252d7f (diff)
Add tests for invalid hour, minute and second
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/time.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/time.rs b/src/time.rs
index 4c32785..0d1f190 100644
--- a/src/time.rs
+++ b/src/time.rs
@@ -312,4 +312,22 @@ mod tests {
let time = IcalTime::floating_ymd(2000, 12, 32);
assert_eq!("20010101", time.to_string());
}
+
+ #[test]
+ fn test_invalid_hour() {
+ let time = IcalTime::floating_ymd(2000, 12, 31).and_hms(25, 0, 0);
+ assert_eq!("20010101T010000", time.to_string());
+ }
+
+ #[test]
+ fn test_invalid_minute() {
+ let time = IcalTime::floating_ymd(2000, 12, 31).and_hms(24, 61, 0);
+ assert_eq!("20010101T010100", time.to_string());
+ }
+
+ #[test]
+ fn test_invalid_second() {
+ let time = IcalTime::floating_ymd(2000, 12, 31).and_hms(24, 60, 61);
+ assert_eq!("20010101T010101", time.to_string());
+ }
}