Rocket/examples/request_local_state/src/tests.rs

15 lines
381 B
Rust

use std::sync::atomic::{Ordering};
use super::{rocket, Atomics};
use rocket::local::Client;
#[test]
fn test() {
let client = Client::new(rocket()).unwrap();
client.get("/").dispatch();
let atomics = client.rocket().state::<Atomics>().unwrap();
assert_eq!(atomics.uncached.load(Ordering::Relaxed), 2);
assert_eq!(atomics.cached.load(Ordering::Relaxed), 1);
}