summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars/tests/helper_with_space.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
commit246f239d9f40f633160f0c18f87a20922d4e77bb (patch)
tree5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/handlebars/tests/helper_with_space.rs
parentReleasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz
rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/handlebars/tests/helper_with_space.rs')
-rw-r--r--vendor/handlebars/tests/helper_with_space.rs54
1 files changed, 54 insertions, 0 deletions
diff --git a/vendor/handlebars/tests/helper_with_space.rs b/vendor/handlebars/tests/helper_with_space.rs
index 5a55ab122..853d5d24a 100644
--- a/vendor/handlebars/tests/helper_with_space.rs
+++ b/vendor/handlebars/tests/helper_with_space.rs
@@ -34,3 +34,57 @@ fn test_helper_with_space_param() {
.unwrap();
assert_eq!(s, "Output: Mozilla Firefox, Google Chrome".to_owned());
}
+
+#[test]
+fn test_empty_lines_472() {
+ let mut r = Handlebars::new();
+
+ r.register_template_string(
+ "t1",
+ r#"{{#each routes}}
+import { default as {{this.handler}} } from '{{this.file_path}}'
+{{/each}}
+
+addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})"#,
+ )
+ .unwrap();
+
+ r.register_template_string(
+ "t2",
+ r#"addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})
+
+{{#each routes}}
+import { default as {{this.handler}} } from '{{this.file_path}}'
+{{/each}}
+"#,
+ )
+ .unwrap();
+
+ let data = json!({"routes": [{"handler": "__hello_handler", "file_path": "./hello.js"},
+ {"handler": "__world_index_handler", "file_path": "./world/index.js"},
+ {"handler": "__index_handler", "file_path": "./index.js"}]});
+
+ let exp1 = r#"import { default as __hello_handler } from './hello.js'
+import { default as __world_index_handler } from './world/index.js'
+import { default as __index_handler } from './index.js'
+
+addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})"#;
+
+ let exp2 = r#"addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})
+
+import { default as __hello_handler } from './hello.js'
+import { default as __world_index_handler } from './world/index.js'
+import { default as __index_handler } from './index.js'
+"#;
+
+ assert_eq!(r.render("t1", &data).unwrap(), exp1);
+ assert_eq!(r.render("t2", &data).unwrap(), exp2);
+}