mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 05:41:50 +01:00
more tests
This commit is contained in:
parent
c3e71bb9ad
commit
b79187a425
@ -40,7 +40,7 @@ script:
|
|||||||
# Upload docs
|
# Upload docs
|
||||||
after_success:
|
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 &&
|
cargo doc --no-deps &&
|
||||||
echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html &&
|
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 &&
|
git clone https://github.com/davisp/ghp-import.git &&
|
||||||
|
@ -58,3 +58,12 @@ impl fmt::Write for CachedDate {
|
|||||||
fn test_date_len() {
|
fn test_date_len() {
|
||||||
assert_eq!(DATE_VALUE_LENGTH, "Sun, 06 Nov 1994 08:49:37 GMT".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);
|
||||||
|
}
|
||||||
|
16
src/error.rs
16
src/error.rs
@ -144,7 +144,21 @@ mod tests {
|
|||||||
use std::error::Error as StdError;
|
use std::error::Error as StdError;
|
||||||
use std::io;
|
use std::io;
|
||||||
use httparse;
|
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]
|
#[test]
|
||||||
fn test_cause() {
|
fn test_cause() {
|
||||||
|
@ -39,6 +39,9 @@ fn test_request_cookies() {
|
|||||||
let cookie = cookie.unwrap();
|
let cookie = cookie.unwrap();
|
||||||
assert_eq!(cookie.name(), "cookie1");
|
assert_eq!(cookie.name(), "cookie1");
|
||||||
assert_eq!(cookie.value(), "value1");
|
assert_eq!(cookie.value(), "value1");
|
||||||
|
|
||||||
|
let cookie = req.cookie("cookie-unknown");
|
||||||
|
assert!(cookie.is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user