summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars/tests/embed.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/handlebars/tests/embed.rs')
-rw-r--r--vendor/handlebars/tests/embed.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/handlebars/tests/embed.rs b/vendor/handlebars/tests/embed.rs
new file mode 100644
index 000000000..019f27db9
--- /dev/null
+++ b/vendor/handlebars/tests/embed.rs
@@ -0,0 +1,29 @@
+#[macro_use]
+extern crate serde_json;
+
+use handlebars::Handlebars;
+
+#[test]
+#[cfg(feature = "rust-embed")]
+fn test_embed() {
+ use rust_embed::RustEmbed;
+
+ #[derive(RustEmbed)]
+ #[folder = "tests/templates/"]
+ #[include = "*.hbs"]
+ struct Templates;
+
+ let mut hbs = Handlebars::new();
+ hbs.register_embed_templates::<Templates>().unwrap();
+
+ assert_eq!(1, hbs.get_templates().len());
+
+ let data = json!({
+ "name": "Andy"
+ });
+
+ assert_eq!(
+ hbs.render("hello.hbs", &data).unwrap().trim(),
+ "Hello, Andy"
+ );
+}