mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 21:41:35 +00:00
34 lines
598 B
Rust
34 lines
598 B
Rust
#[macro_use]
|
|
extern crate askama;
|
|
|
|
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");
|
|
}
|
|
|
|
|
|
#[derive(Template)]
|
|
#[template(path = "operators.html")]
|
|
struct OperatorsTemplate {
|
|
a: usize,
|
|
b: usize,
|
|
c: usize,
|
|
}
|
|
|
|
#[test]
|
|
fn test_operators() {
|
|
let t = OperatorsTemplate { a: 1, b: 1, c: 2 };
|
|
assert_eq!(t.render(), "muldivmodaddrshlshbandbxorborandor");
|
|
}
|