blob: 1c740556fef19e7bc4f9689bd7cdc1fce347bd12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use handlebars::Handlebars;
use serde_json::json;
#[test]
fn test_whitespaces_elision() {
let hbs = Handlebars::new();
assert_eq!(
"bar",
hbs.render_template(" {{~ foo ~}} ", &json!({"foo": "bar"}))
.unwrap()
);
assert_eq!(
"<bar/>",
hbs.render_template(" {{{~ foo ~}}} ", &json!({"foo": "<bar/>"}))
.unwrap()
);
assert_eq!(
"<bar/>",
hbs.render_template(" {{~ {foo} ~}} ", &json!({"foo": "<bar/>"}))
.unwrap()
);
}
|