aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/simple.rs
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tests/simple.rs')
-rw-r--r--testing/tests/simple.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
new file mode 100644
index 0000000..0943f12
--- /dev/null
+++ b/testing/tests/simple.rs
@@ -0,0 +1,28 @@
+#![feature(proc_macro)]
+
+#[macro_use]
+extern crate askama_derive;
+extern crate askama;
+
+use askama::Template;
+
+#[derive(Template)]
+#[template(path = "simple.html")]
+struct TestTemplate {
+ strvar: String,
+ num: i64,
+ i18n: String,
+}
+
+#[test]
+fn it_works() {
+ let s = TestTemplate {
+ strvar: "foo".to_string(),
+ num: 42,
+ i18n: "Iñtërnâtiônàlizætiøn".to_string(),
+ };
+ assert_eq!(s.render(), "hello world, foo\n\
+ with number: 42\n\
+ Iñtërnâtiônàlizætiøn is important\n\
+ in vars too: Iñtërnâtiônàlizætiøn\n");
+}