summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars/tests/root_var.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/handlebars/tests/root_var.rs')
-rw-r--r--vendor/handlebars/tests/root_var.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/handlebars/tests/root_var.rs b/vendor/handlebars/tests/root_var.rs
new file mode 100644
index 000000000..fb310f6c1
--- /dev/null
+++ b/vendor/handlebars/tests/root_var.rs
@@ -0,0 +1,21 @@
+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;"
+ );
+}