1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-13 02:39:32 +00:00

more tests

This commit is contained in:
Nikolay Kim 2017-10-14 23:14:26 -07:00
parent c3e71bb9ad
commit b79187a425
4 changed files with 28 additions and 2 deletions

View file

@ -40,7 +40,7 @@ script:
# Upload docs
after_success:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_RUST_VERSION" == "stable" ]]; then
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
cargo doc --no-deps &&
echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html &&
git clone https://github.com/davisp/ghp-import.git &&

View file

@ -58,3 +58,12 @@ impl fmt::Write for CachedDate {
fn test_date_len() {
assert_eq!(DATE_VALUE_LENGTH, "Sun, 06 Nov 1994 08:49:37 GMT".len());
}
#[test]
fn test_date() {
let mut buf1 = BytesMut::new();
extend(&mut buf1);
let mut buf2 = BytesMut::new();
extend(&mut buf2);
assert_eq!(buf1, buf2);
}

View file

@ -144,7 +144,21 @@ mod tests {
use std::error::Error as StdError;
use std::io;
use httparse;
use super::ParseError;
use http::StatusCode;
use cookie::ParseError as CookieParseError;
use super::{ParseError, HttpResponse, HttpRangeParseError};
#[test]
fn test_into_response() {
let resp: HttpResponse = ParseError::Incomplete.into();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
let resp: HttpResponse = HttpRangeParseError::InvalidRange.into();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
let resp: HttpResponse = CookieParseError::EmptyName.into();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
}
#[test]
fn test_cause() {

View file

@ -39,6 +39,9 @@ fn test_request_cookies() {
let cookie = cookie.unwrap();
assert_eq!(cookie.name(), "cookie1");
assert_eq!(cookie.value(), "value1");
let cookie = req.cookie("cookie-unknown");
assert!(cookie.is_none());
}
#[test]