Fix examples to use new names

For some reason, the scripts/test.sh does not successfully run all tests
- it terminates on the doctest step with a sigkill. This means I have to
push changes to github to test them.
This commit is contained in:
Matthew Pomes 2023-09-14 01:18:55 -05:00 committed by Sergio Benitez
parent bd1d0f5c6c
commit 09ebdbd6f9
1 changed files with 9 additions and 6 deletions

View File

@ -31,7 +31,7 @@ fn hello() {
let uri = format!("/?{}{}{}", q("lang", lang), q("emoji", emoji), q("name", name));
let response = client.get(uri).dispatch();
assert!(
response.routed_by::<super::hello>(),
response.was_routed_by::<super::hello>(),
"Response was not generated by the `hello` route"
);
assert_eq!(response.into_string().unwrap(), expected);
@ -39,7 +39,7 @@ fn hello() {
let uri = format!("/?{}{}{}", q("emoji", emoji), q("name", name), q("lang", lang));
let response = client.get(uri).dispatch();
assert!(
response.routed_by::<super::hello>(),
response.was_routed_by::<super::hello>(),
"Response was not generated by the `hello` route"
);
assert_eq!(response.into_string().unwrap(), expected);
@ -51,7 +51,7 @@ fn hello_world() {
let client = Client::tracked(super::rocket()).unwrap();
let response = client.get("/hello/world").dispatch();
assert!(
response.routed_by::<super::world>(),
response.was_routed_by::<super::world>(),
"Response was not generated by the `world` route"
);
assert_eq!(response.into_string(), Some("Hello, world!".into()));
@ -61,7 +61,10 @@ fn hello_world() {
fn hello_mir() {
let client = Client::tracked(super::rocket()).unwrap();
let response = client.get("/hello/%D0%BC%D0%B8%D1%80").dispatch();
assert!(response.routed_by::<super::mir>(), "Response was not generated by the `mir` route");
assert!(
response.was_routed_by::<super::mir>(),
"Response was not generated by the `mir` route"
);
assert_eq!(response.into_string(), Some("Привет, мир!".into()));
}
@ -74,7 +77,7 @@ fn wave() {
let expected = format!("👋 Hello, {} year old named {}!", age, real_name);
let response = client.get(uri).dispatch();
assert!(
response.routed_by::<super::wave>(),
response.was_routed_by::<super::wave>(),
"Response was not generated by the `wave` route"
);
assert_eq!(response.into_string().unwrap(), expected);
@ -83,7 +86,7 @@ fn wave() {
let bad_uri = format!("/wave/{}/{}", name, bad_age);
let response = client.get(bad_uri).dispatch();
assert!(
response.caught_by::<rocket::catcher::DefaultCatcher>(),
response.was_caught_by::<rocket::catcher::DefaultCatcher>(),
"Response was not generated by the default catcher"
);
assert_eq!(response.status(), Status::NotFound);