| 1 | extern crate handlebarsrust-analyzer cargo handlebars 5.1.2 handlebars/; |
| 2 | #[macro_use] |
| 3 | extern crate serde_jsonrust-analyzer cargo handlebars 5.1.2 serde_json/; |
| 4 | |
| 5 | use handlebarsrust-analyzer cargo handlebars 5.1.2 crate/::Handlebarsrust-analyzer cargo handlebars 5.1.2 registry/Registry#; |
| 6 | |
| 7 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 8 | fn test_root_varrust-analyzer cargo handlebars 5.1.2 test_root_var().() { |
| 9 | let hbs = Handlebarsrust-analyzer cargo handlebars 5.1.2 registry/Registry#::newrust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]new().(); |
| 10 | |
| 11 | let data = jsonrust-analyzer cargo serde_json 1.0.114 macros/json!!({ |
| 12 | "a": [1, 2, 3, 4], |
| 13 | "b": "top" |
| 14 | }); |
| 15 | |
| 16 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 17 | hbs.render_templaterust-analyzer cargo handlebars 5.1.2 registry/impl#[`Registry<'reg>`]render_template().("{{#each a}}{{@root/b}}: {{this}};{{/each}}", &data) |
| 18 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 19 | "top: 1;top: 2;top: 3;top: 4;" |
| 20 | ); |
| 21 | } |