aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/simple.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-04 16:24:02 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-04 16:25:00 +0100
commit8041160766f799f6c474d393568e5a15e1a551e3 (patch)
tree7e24d2487d072bed1037d1ada9b5ebd8cd890f9f /testing/tests/simple.rs
parent31bad55f2c3729a37ecc9d23535fc0c3ce53772d (diff)
downloadaskama-8041160766f799f6c474d393568e5a15e1a551e3.tar.gz
askama-8041160766f799f6c474d393568e5a15e1a551e3.tar.bz2
askama-8041160766f799f6c474d393568e5a15e1a551e3.zip
Use &str instead of String for test cases
Diffstat (limited to '')
-rw-r--r--testing/tests/simple.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index ab5e209..63203e7 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -6,8 +6,8 @@ use askama::Template;
#[derive(Template)]
#[template(path = "simple.html")]
-struct VariablesTemplate {
- strvar: String,
+struct VariablesTemplate<'a> {
+ strvar: &'a str,
num: i64,
i18n: String,
}
@@ -15,7 +15,7 @@ struct VariablesTemplate {
#[test]
fn test_variables() {
let s = VariablesTemplate {
- strvar: "foo".to_string(),
+ strvar: "foo",
num: 42,
i18n: "Iñtërnâtiônàlizætiøn".to_string(),
};
@@ -68,14 +68,14 @@ fn test_else_if() {
#[derive(Template)]
#[template(path = "for.html")]
-struct ForTemplate {
- strings: Vec<String>,
+struct ForTemplate<'a> {
+ strings: Vec<&'a str>,
}
#[test]
fn test_for() {
let s = ForTemplate {
- strings: vec!["A".to_string(), "alfa".to_string(), "1".to_string()],
+ strings: vec!["A", "alfa", "1"],
};
assert_eq!(s.render(), "\n A\n\n alfa\n\n 1\n\n");
}