aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-03-03 16:44:54 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-03-03 16:44:54 +0100
commitaa98f61fa78b2a81e47419feae188308d30bacf6 (patch)
treeb9782fe6b3620d94e3edf8a5b9a3d458f5699e31 /testing
parent24c5693de8acd454b3e6e3b95107ba7e7823d256 (diff)
downloadaskama-aa98f61fa78b2a81e47419feae188308d30bacf6.tar.gz
askama-aa98f61fa78b2a81e47419feae188308d30bacf6.tar.bz2
askama-aa98f61fa78b2a81e47419feae188308d30bacf6.zip
Discard trailing newlines from templates by default
This matches Jinja's behavior, and seems sensible.
Diffstat (limited to 'testing')
-rw-r--r--testing/tests/filters.rs4
-rw-r--r--testing/tests/inheritance.rs4
-rw-r--r--testing/tests/operators.rs2
-rw-r--r--testing/tests/simple.rs18
4 files changed, 14 insertions, 14 deletions
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs
index 73b660a..5882bae 100644
--- a/testing/tests/filters.rs
+++ b/testing/tests/filters.rs
@@ -16,7 +16,7 @@ fn filter_escape() {
strvar: "my <html> is unsafe & should be escaped".to_string(),
};
assert_eq!(s.render(),
- "my &lt;html&gt; is unsafe &amp; should be escaped\n");
+ "my &lt;html&gt; is unsafe &amp; should be escaped");
}
@@ -29,5 +29,5 @@ struct FormatTemplate<'a> {
#[test]
fn filter_format() {
let t = FormatTemplate { var: "formatted" };
- assert_eq!(t.render(), "\"formatted\"\n");
+ assert_eq!(t.render(), "\"formatted\"");
}
diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs
index 2fd06ba..b3add1c 100644
--- a/testing/tests/inheritance.rs
+++ b/testing/tests/inheritance.rs
@@ -19,11 +19,11 @@ struct ChildTemplate<'a> {
#[test]
fn test_use_base_directly() {
let t = BaseTemplate { title: "Foo" };
- assert_eq!(t.render(), "Foo\n\nCopyright 2017\n");
+ assert_eq!(t.render(), "Foo\n\nCopyright 2017");
}
#[test]
fn test_simple_extends() {
let t = ChildTemplate { _parent: BaseTemplate { title: "Bar" } };
- assert_eq!(t.render(), "Bar\nContent goes here\nCopyright 2017\n");
+ assert_eq!(t.render(), "Bar\nContent goes here\nCopyright 2017");
}
diff --git a/testing/tests/operators.rs b/testing/tests/operators.rs
index 73745f0..70d26b1 100644
--- a/testing/tests/operators.rs
+++ b/testing/tests/operators.rs
@@ -15,7 +15,7 @@ struct CompareTemplate {
#[test]
fn test_compare() {
let t = CompareTemplate { a: 1, b: 1, c: 2 };
- assert_eq!(t.render(), "tf\ntf\ntf\ntf\ntf\ntf\n");
+ assert_eq!(t.render(), "tf\ntf\ntf\ntf\ntf\ntf");
}
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index 454c1e2..2f69c84 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -22,7 +22,7 @@ fn test_variables() {
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");
+ in vars too: Iñtërnâtiônàlizætiøn");
}
@@ -35,7 +35,7 @@ struct IfTemplate {
#[test]
fn test_if() {
let s = IfTemplate { cond: true };
- assert_eq!(s.render(), "true\n");
+ assert_eq!(s.render(), "true");
}
@@ -48,7 +48,7 @@ struct ElseTemplate {
#[test]
fn test_else() {
let s = ElseTemplate { cond: false };
- assert_eq!(s.render(), "false\n");
+ assert_eq!(s.render(), "false");
}
@@ -62,7 +62,7 @@ struct ElseIfTemplate {
#[test]
fn test_else_if() {
let s = ElseIfTemplate { cond: false, check: true };
- assert_eq!(s.render(), "checked\n");
+ assert_eq!(s.render(), "checked");
}
@@ -77,7 +77,7 @@ fn test_for() {
let s = ForTemplate {
strings: vec!["A", "alfa", "1"],
};
- assert_eq!(s.render(), "0. A\n1. alfa\n2. 1\n\n");
+ assert_eq!(s.render(), "0. A\n1. alfa\n2. 1\n");
}
@@ -88,7 +88,7 @@ struct LiteralsTemplate {}
#[test]
fn test_literals() {
let s = LiteralsTemplate {};
- assert_eq!(s.render(), "a\n");
+ assert_eq!(s.render(), "a");
}
@@ -105,7 +105,7 @@ struct AttrTemplate {
#[test]
fn test_attr() {
let t = AttrTemplate { inner: Holder { a: 5 } };
- assert_eq!(t.render(), "5\n");
+ assert_eq!(t.render(), "5");
}
@@ -118,7 +118,7 @@ struct OptionTemplate<'a> {
#[test]
fn test_option() {
let some = OptionTemplate { var: Some("foo") };
- assert_eq!(some.render(), "some: foo\n");
+ assert_eq!(some.render(), "some: foo");
let none = OptionTemplate { var: None };
- assert_eq!(none.render(), "none\n");
+ assert_eq!(none.render(), "none");
}