diff --git a/src/libcore/tests/time.rs b/src/libcore/tests/time.rs index 273f1258bb090..c1fbdf7df76fc 100644 --- a/src/libcore/tests/time.rs +++ b/src/libcore/tests/time.rs @@ -11,6 +11,12 @@ fn creation() { assert_eq!(Duration::from_millis(4000), Duration::new(4, 0)); } +#[test] +#[should_panic] +fn new_overflow() { + let _ = Duration::new(::core::u64::MAX, 1_000_000_000); +} + #[test] fn secs() { assert_eq!(Duration::new(0, 0).as_secs(), 0);