diff options
Diffstat (limited to '')
-rw-r--r-- | testing/tests/macro.rs | 10 | ||||
-rw-r--r-- | testing/tests/operators.rs | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/testing/tests/macro.rs b/testing/tests/macro.rs index 51fbcdc..459b1e2 100644 --- a/testing/tests/macro.rs +++ b/testing/tests/macro.rs @@ -43,3 +43,13 @@ fn test_deep_import() { let t = DeepImportTemplate; assert_eq!(t.render().unwrap(), "foo"); } + +#[derive(Template)] +#[template(path = "macro-short-circuit.html")] +struct ShortCircuitTemplate {} + +#[test] +fn test_short_circuit() { + let t = ShortCircuitTemplate {}; + assert_eq!(t.render().unwrap(), "truetruetruefalsetruetrue"); +} diff --git a/testing/tests/operators.rs b/testing/tests/operators.rs index 99a2a4c..05c1dab 100644 --- a/testing/tests/operators.rs +++ b/testing/tests/operators.rs @@ -53,3 +53,13 @@ fn test_ranges() { }; assert_eq!(t.render().unwrap(), "abcd\nbcd\n\na\nab"); } + +#[derive(Template)] +#[template(source = "{{ true && true }}{{ false || true }}", ext = "txt")] +struct ShortCircuitTemplate {} + +#[test] +fn test_short_circuit() { + let t = ShortCircuitTemplate {}; + assert_eq!(t.render().unwrap(), "truetrue"); +} |