Skip to content

Commit 27305d3

Browse files
committed
add failing test
1 parent d8b8921 commit 27305d3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

examples/hello-world/src/main.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//! ```
66
77
use axum::{response::Html, routing::get, Router};
8-
98
#[tokio::main]
109
async fn main() {
1110
// build our application with a route
@@ -20,5 +19,19 @@ async fn main() {
2019
}
2120

2221
async fn handler() -> Html<&'static str> {
23-
Html("<h1>Hello, World!</h1>")
22+
Html("<h1>Hello, World</h1>")
2423
}
24+
25+
26+
#[cfg(test)]
27+
mod tests {
28+
use super::*;
29+
use axum::response::Html;
30+
31+
#[tokio::test]
32+
async fn test_handler() {
33+
let response = handler().await;
34+
let Html(content) = response;
35+
assert_eq!(content, "<h1>Hello, World!</h1>");
36+
}
37+
}

0 commit comments

Comments
 (0)