aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/templates/simple-no-escape.txt5
-rw-r--r--testing/tests/simple.rs24
2 files changed, 29 insertions, 0 deletions
diff --git a/testing/templates/simple-no-escape.txt b/testing/templates/simple-no-escape.txt
new file mode 100644
index 0000000..cc839dc
--- /dev/null
+++ b/testing/templates/simple-no-escape.txt
@@ -0,0 +1,5 @@
+{# our very first test! #}
+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
index e19b32e..d4d2964 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -31,6 +31,30 @@ fn test_variables() {
}
#[derive(Template)]
+#[template(path = "simple-no-escape.txt")]
+struct VariablesTemplateNoEscape<'a> {
+ strvar: &'a str,
+ num: i64,
+ i18n: String,
+}
+
+#[test]
+fn test_variables_no_escape() {
+ let s = VariablesTemplateNoEscape {
+ strvar: "foo",
+ num: 42,
+ i18n: "Iñtërnâtiônàlizætiøn".to_string(),
+ };
+ assert_eq!(
+ s.render().unwrap(),
+ "\nhello 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"
+ );
+}
+
+#[derive(Template)]
#[template(path = "if.html")]
struct IfTemplate {
cond: bool,