Skip to content

Commit 09ebdbd

Browse files
the10thWizSergioBenitez
authored andcommitted
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.
1 parent bd1d0f5 commit 09ebdbd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Diff for: examples/hello/src/tests.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ fn hello() {
3131
let uri = format!("/?{}{}{}", q("lang", lang), q("emoji", emoji), q("name", name));
3232
let response = client.get(uri).dispatch();
3333
assert!(
34-
response.routed_by::<super::hello>(),
34+
response.was_routed_by::<super::hello>(),
3535
"Response was not generated by the `hello` route"
3636
);
3737
assert_eq!(response.into_string().unwrap(), expected);
3838

3939
let uri = format!("/?{}{}{}", q("emoji", emoji), q("name", name), q("lang", lang));
4040
let response = client.get(uri).dispatch();
4141
assert!(
42-
response.routed_by::<super::hello>(),
42+
response.was_routed_by::<super::hello>(),
4343
"Response was not generated by the `hello` route"
4444
);
4545
assert_eq!(response.into_string().unwrap(), expected);
@@ -51,7 +51,7 @@ fn hello_world() {
5151
let client = Client::tracked(super::rocket()).unwrap();
5252
let response = client.get("/hello/world").dispatch();
5353
assert!(
54-
response.routed_by::<super::world>(),
54+
response.was_routed_by::<super::world>(),
5555
"Response was not generated by the `world` route"
5656
);
5757
assert_eq!(response.into_string(), Some("Hello, world!".into()));
@@ -61,7 +61,10 @@ fn hello_world() {
6161
fn hello_mir() {
6262
let client = Client::tracked(super::rocket()).unwrap();
6363
let response = client.get("/hello/%D0%BC%D0%B8%D1%80").dispatch();
64-
assert!(response.routed_by::<super::mir>(), "Response was not generated by the `mir` route");
64+
assert!(
65+
response.was_routed_by::<super::mir>(),
66+
"Response was not generated by the `mir` route"
67+
);
6568
assert_eq!(response.into_string(), Some("Привет, мир!".into()));
6669
}
6770

@@ -74,7 +77,7 @@ fn wave() {
7477
let expected = format!("👋 Hello, {} year old named {}!", age, real_name);
7578
let response = client.get(uri).dispatch();
7679
assert!(
77-
response.routed_by::<super::wave>(),
80+
response.was_routed_by::<super::wave>(),
7881
"Response was not generated by the `wave` route"
7982
);
8083
assert_eq!(response.into_string().unwrap(), expected);
@@ -83,7 +86,7 @@ fn wave() {
8386
let bad_uri = format!("/wave/{}/{}", name, bad_age);
8487
let response = client.get(bad_uri).dispatch();
8588
assert!(
86-
response.caught_by::<rocket::catcher::DefaultCatcher>(),
89+
response.was_caught_by::<rocket::catcher::DefaultCatcher>(),
8790
"Response was not generated by the default catcher"
8891
);
8992
assert_eq!(response.status(), Status::NotFound);

0 commit comments

Comments
 (0)