diff options
author | Christian Vallentin <mail@vallentin.dev> | 2020-12-01 17:01:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 17:01:05 +0100 |
commit | a199defeca2dfc6aa3e972acca82c96db07f99e9 (patch) | |
tree | 737d61c5e0766244e992e4f79d0311b515d1c6ec /testing/tests | |
parent | 266c606e39402a7c0cd357cdda8881e8f2ea417f (diff) | |
download | askama-a199defeca2dfc6aa3e972acca82c96db07f99e9.tar.gz askama-a199defeca2dfc6aa3e972acca82c96db07f99e9.tar.bz2 askama-a199defeca2dfc6aa3e972acca82c96db07f99e9.zip |
Improved if statement generation to avoid issues with implicit borrows (#392)
* Changed to automatically coerce to bool
* Added new test case
* Updated test case to include else if
Diffstat (limited to 'testing/tests')
-rw-r--r-- | testing/tests/coerce.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/tests/coerce.rs b/testing/tests/coerce.rs new file mode 100644 index 0000000..1a44781 --- /dev/null +++ b/testing/tests/coerce.rs @@ -0,0 +1,14 @@ +use askama::Template; + +#[derive(Template)] +#[template(path = "if-coerce.html")] +struct IfCoerceTemplate { + t: bool, + f: bool, +} + +#[test] +fn test_coerce() { + let t = IfCoerceTemplate { t: true, f: false }; + assert_eq!(t.render().unwrap(), "ftftfttftelseifelseif"); +} |