From b7510bd89f54f0ccb9040f41d911be2aa30f46f0 Mon Sep 17 00:00:00 2001 From: Jeena Lee Date: Thu, 7 Jul 2016 13:14:35 -0700 Subject: [PATCH] Add test to assert that servo panics when the length of a given data is zero. --- tests/unit/profile/time.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/profile/time.rs b/tests/unit/profile/time.rs index 9bae5801262..911f1cf95c0 100644 --- a/tests/unit/profile/time.rs +++ b/tests/unit/profile/time.rs @@ -44,3 +44,11 @@ fn time_profiler_unsorted_stats_test() { let unsorted_data = vec![5.0, 7.5, 1.0, 8.9]; time::Profiler::get_statistics(&unsorted_data); } + +#[cfg(debug_assertions)] +#[test] +#[should_panic] +fn time_profiler_data_len_zero() { + let zero_data = vec![]; + time::Profiler::get_statistics(&zero_data); +}