#![feature(plugin)] #![plugin(rocket_codegen)] extern crate rocket; #[get("/")] fn hello() -> &'static str { "Hello, world!" } fn main() { rocket::ignite().mount("/", routes![hello]).launch() } #[cfg(test)] mod test { use super::rocket; use rocket::testing::MockRequest; use rocket::http::Method::*; #[test] fn test_hello() { let rocket = rocket::ignite().mount("/", routes![super::hello]); let result = MockRequest::new(Get, "/").dispatch_with(&rocket); assert_eq!(result.unwrap().as_str(), "Hello, world!"); } }