Fix the actix-http:🍪:do_not_panic_on_large_max_ages test

This commit is contained in:
kevinpoitra 2020-01-08 02:20:57 -06:00
parent 0eb8d07e84
commit 85e341b0b0
1 changed files with 4 additions and 3 deletions

View File

@ -413,8 +413,9 @@ mod tests {
#[test] #[test]
fn do_not_panic_on_large_max_ages() { fn do_not_panic_on_large_max_ages() {
let max_seconds = Duration::max_value().whole_seconds(); let max_duration = Duration::max_value();
let expected = Cookie::build("foo", "bar").max_age(max_seconds).finish(); let expected = Cookie::build("foo", "bar").max_age_time(max_duration).finish();
assert_eq_parse!(format!(" foo=bar; Max-Age={:?}", max_seconds + 1), expected); let overflow_duration = max_duration.checked_add(Duration::nanoseconds(1)).unwrap_or(max_duration);
assert_eq_parse!(format!(" foo=bar; Max-Age={:?}", overflow_duration.whole_seconds()), expected);
} }
} }