mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-24 12:51:31 +00:00
22 lines
402 B
Rust
22 lines
402 B
Rust
extern crate handlebars;
|
|
#[macro_use]
|
|
extern crate serde_json;
|
|
|
|
use handlebars::Handlebars;
|
|
|
|
#[test]
|
|
fn test_root_var() {
|
|
let hbs = Handlebars::new();
|
|
|
|
let data = json!({
|
|
"a": [1, 2, 3, 4],
|
|
"b": "top"
|
|
});
|
|
|
|
assert_eq!(
|
|
hbs.render_template("{{#each a}}{{@root/b}}: {{this}};{{/each}}", &data)
|
|
.unwrap(),
|
|
"top: 1;top: 2;top: 3;top: 4;"
|
|
);
|
|
}
|