From 40775d8c885bda6bd8e086bcc03127c714fc890e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 23 Aug 2017 20:43:11 +0200 Subject: Add test for Iron support --- testing/tests/iron.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 testing/tests/iron.rs (limited to 'testing/tests/iron.rs') diff --git a/testing/tests/iron.rs b/testing/tests/iron.rs new file mode 100644 index 0000000..51c7b8d --- /dev/null +++ b/testing/tests/iron.rs @@ -0,0 +1,20 @@ +#[macro_use] +extern crate askama; +extern crate iron; + +use askama::Template; +use iron::{status, Response}; + +#[derive(Template)] +#[template(path = "hello.html")] +struct HelloTemplate<'a> { + name: &'a str, +} + +#[test] +fn test_iron() { + let rsp = Response::with((status::Ok, HelloTemplate { name: "world" })); + let mut buf = Vec::new(); + let _ = rsp.body.unwrap().write_body(&mut buf); + assert_eq!(buf, "Hello, world!".as_bytes()); +} -- cgit