-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: René Kijewski <rene.kijewski@fu-berlin.de>
- Loading branch information
1 parent
627d58b
commit 34f84dc
Showing
6 changed files
with
73 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use askama::Template; | ||
|
||
#[derive(Template)] | ||
#[template( | ||
source = r#"{%- if s == "" -%} | ||
empty | ||
{%- else if s == "b" -%} | ||
b | ||
{%- elif s == "c" -%} | ||
c | ||
{%- else -%} | ||
else | ||
{%- endif -%}"#, | ||
ext = "txt" | ||
)] | ||
struct If<'a> { | ||
s: &'a str, | ||
} | ||
|
||
#[test] | ||
fn test_if() { | ||
assert_eq!(If { s: "" }.render().unwrap(), "empty"); | ||
assert_eq!(If { s: "b" }.render().unwrap(), "b"); | ||
assert_eq!(If { s: "c" }.render().unwrap(), "c"); | ||
assert_eq!(If { s: "d" }.render().unwrap(), "else"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.