mirror of
https://github.com/actix/actix-web.git
synced 2024-11-19 16:11:07 +00:00
use assert and restore test case
This commit is contained in:
parent
c43b6e3577
commit
2214492792
3 changed files with 14 additions and 10 deletions
|
@ -36,7 +36,7 @@ script:
|
||||||
fi
|
fi
|
||||||
- |
|
- |
|
||||||
if [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
|
if [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
|
||||||
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin
|
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install -f cargo-tarpaulin
|
||||||
cargo tarpaulin --features="alpn,tls" --out Xml --no-count
|
cargo tarpaulin --features="alpn,tls" --out Xml --no-count
|
||||||
bash <(curl -s https://codecov.io/bash)
|
bash <(curl -s https://codecov.io/bash)
|
||||||
echo "Uploaded code coverage"
|
echo "Uploaded code coverage"
|
||||||
|
|
|
@ -211,9 +211,11 @@ impl<S: 'static> Router<S> {
|
||||||
|
|
||||||
let name = resource.get_name();
|
let name = resource.get_name();
|
||||||
if !name.is_empty() {
|
if !name.is_empty() {
|
||||||
if inner.named.contains_key(name) {
|
assert!(
|
||||||
panic!("Named resource {:?} is registered.", name);
|
!inner.named.contains_key(name),
|
||||||
}
|
"Named resource {:?} is registered.",
|
||||||
|
name
|
||||||
|
);
|
||||||
inner.named.insert(name.to_owned(), resource.rdef().clone());
|
inner.named.insert(name.to_owned(), resource.rdef().clone());
|
||||||
}
|
}
|
||||||
inner.patterns.push(resource.rdef().clone());
|
inner.patterns.push(resource.rdef().clone());
|
||||||
|
@ -279,9 +281,11 @@ impl<S: 'static> Router<S> {
|
||||||
|
|
||||||
pub(crate) fn register_external(&mut self, name: &str, rdef: ResourceDef) {
|
pub(crate) fn register_external(&mut self, name: &str, rdef: ResourceDef) {
|
||||||
let inner = Rc::get_mut(&mut self.defs).unwrap();
|
let inner = Rc::get_mut(&mut self.defs).unwrap();
|
||||||
if inner.named.contains_key(name) {
|
assert!(
|
||||||
panic!("Named resource {:?} is registered.", name);
|
!inner.named.contains_key(name),
|
||||||
}
|
"Named resource {:?} is registered.",
|
||||||
|
name
|
||||||
|
);
|
||||||
inner.named.insert(name.to_owned(), rdef);
|
inner.named.insert(name.to_owned(), rdef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -910,9 +910,9 @@ mod tests {
|
||||||
})
|
})
|
||||||
.finish();
|
.finish();
|
||||||
|
|
||||||
//let req = TestRequest::with_uri("/app/t1").request();
|
let req = TestRequest::with_uri("/app/t1").request();
|
||||||
//let resp = app.run(req);
|
let resp = app.run(req);
|
||||||
//assert_eq!(resp.as_msg().status(), StatusCode::NOT_FOUND);
|
assert_eq!(resp.as_msg().status(), StatusCode::NOT_FOUND);
|
||||||
|
|
||||||
let req = TestRequest::with_uri("/app/t1/").request();
|
let req = TestRequest::with_uri("/app/t1/").request();
|
||||||
let resp = app.run(req);
|
let resp = app.run(req);
|
||||||
|
|
Loading…
Reference in a new issue