Skip to content

Commit 271e4be

Browse files
committed
[test] the hello-world example
See tokio-rs#3263
1 parent da3539c commit 271e4be

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/hello-world/src/main.rs

+13
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,16 @@ async fn main() {
2222
async fn handler() -> Html<&'static str> {
2323
Html("<h1>Hello, World!</h1>")
2424
}
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)