aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-17 14:34:24 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-17 14:34:24 +0100
commit1121af3dd03bb000b935036232b11ae4f284195e (patch)
tree592c710cb89541df19ac86da18d82dacd9921b75 /testing
parent22cd667f4ea414884217d8fb37ccd4e3e1369f5a (diff)
downloadaskama-1121af3dd03bb000b935036232b11ae4f284195e.tar.gz
askama-1121af3dd03bb000b935036232b11ae4f284195e.tar.bz2
askama-1121af3dd03bb000b935036232b11ae4f284195e.zip
Split comparison tests from other operators
Diffstat (limited to 'testing')
-rw-r--r--testing/templates/operators.html54
-rw-r--r--testing/tests/operators.rs17
2 files changed, 19 insertions, 52 deletions
diff --git a/testing/templates/operators.html b/testing/templates/operators.html
index 020126b..750f0aa 100644
--- a/testing/templates/operators.html
+++ b/testing/templates/operators.html
@@ -1,57 +1,9 @@
-{% if a == b -%}
- t
-{%- endif -%}
-{% if a == c -%}
- t
-{%- else -%}
- f
-{%- endif %}
-{% if a != c -%}
- t
-{%- endif %}
-{%- if a != b -%}
- t
-{%- else -%}
- f
-{%- endif %}
-{% if c >= b -%}
- t
-{%- endif -%}
-{% if b >= c -%}
- t
-{%- else -%}
- f
-{%- endif %}
-{% if c > b -%}
- t
-{%- endif -%}
-{% if a > c -%}
- t
-{%- else -%}
- f
-{%- endif %}
-{% if a <= b -%}
- t
-{%- endif -%}
-{% if c <= b -%}
- t
-{%- else -%}
- f
-{%- endif %}
-{% if a < c -%}
- t
-{%- endif %}
-{%- if a < b -%}
- t
-{%- else -%}
- f
-{%- endif %}
{% if a * c > b -%}
mul
-{%- endif %}
+{%- endif -%}
{% if c / c == a -%}
div
-{%- endif %}
+{%- endif -%}
{% if a % c == b -%}
mod
-{%- endif %}
+{%- endif -%}
diff --git a/testing/tests/operators.rs b/testing/tests/operators.rs
index 240fd52..d58492e 100644
--- a/testing/tests/operators.rs
+++ b/testing/tests/operators.rs
@@ -5,6 +5,21 @@ extern crate askama_derive;
use askama::Template;
#[derive(Template)]
+#[template(path = "compare.html")]
+struct CompareTemplate {
+ a: usize,
+ b: usize,
+ c: usize,
+}
+
+#[test]
+fn test_compare() {
+ let t = CompareTemplate { a: 1, b: 1, c: 2 };
+ assert_eq!(t.render(), "tf\ntf\ntf\ntf\ntf\ntf\n");
+}
+
+
+#[derive(Template)]
#[template(path = "operators.html")]
struct OperatorsTemplate {
a: usize,
@@ -15,5 +30,5 @@ struct OperatorsTemplate {
#[test]
fn test_operators() {
let t = OperatorsTemplate { a: 1, b: 1, c: 2 };
- assert_eq!(t.render(), "tf\ntf\ntf\ntf\ntf\ntf\nmul\ndiv\nmod\n");
+ assert_eq!(t.render(), "muldivmod");
}