aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-01-03 10:06:47 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-01-03 10:06:47 +0100
commit744b290c8d34c905f285c4b6e675e42281e83204 (patch)
treec49b76081f30577d582e00f6fe29f97f51341fde /testing
parent4c8c773c84a48963e892c72f38f37bcb99b6eb74 (diff)
downloadaskama-744b290c8d34c905f285c4b6e675e42281e83204.tar.gz
askama-744b290c8d34c905f285c4b6e675e42281e83204.tar.bz2
askama-744b290c8d34c905f285c4b6e675e42281e83204.zip
Rename askama_test to testing
Diffstat (limited to 'testing')
-rw-r--r--testing/Cargo.toml9
-rw-r--r--testing/templates/simple.html4
-rw-r--r--testing/tests/simple.rs28
3 files changed, 41 insertions, 0 deletions
diff --git a/testing/Cargo.toml b/testing/Cargo.toml
new file mode 100644
index 0000000..8e7c0f3
--- /dev/null
+++ b/testing/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "askama_testing"
+version = "0.1.0"
+authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
+workspace = ".."
+
+[dependencies]
+askama = { path = "../askama" }
+askama_derive = { path = "../askama_derive" }
diff --git a/testing/templates/simple.html b/testing/templates/simple.html
new file mode 100644
index 0000000..51e225b
--- /dev/null
+++ b/testing/templates/simple.html
@@ -0,0 +1,4 @@
+hello world, {{ strvar }}
+with number: {{ num }}
+Iñtërnâtiônàlizætiøn is important
+in vars too: {{ i18n }}
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");
+}