Skip to content

Commit

Permalink
Fix examples to use new names
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
the10thWiz authored and SergioBenitez committed Oct 18, 2023
1 parent bd1d0f5 commit 09ebdbd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions examples/hello/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ 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);

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);
Expand All @@ -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()));
Expand All @@ -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()));
}

Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 09ebdbd

Please sign in to comment.