summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars/tests/escape.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/handlebars/tests/escape.rs')
-rw-r--r--vendor/handlebars/tests/escape.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/handlebars/tests/escape.rs b/vendor/handlebars/tests/escape.rs
index 4a737f5ce..2b9512290 100644
--- a/vendor/handlebars/tests/escape.rs
+++ b/vendor/handlebars/tests/escape.rs
@@ -27,19 +27,44 @@ fn test_string_no_escape_422() {
handlebars_helper!(replace: |input: str, from: str, to: str| {
input.replace(from, to)
});
+ handlebars_helper!(echo: |input: str| {
+ input
+ });
hbs.register_helper("replace", Box::new(replace));
+ hbs.register_helper("echo", Box::new(echo));
assert_eq!(
r#"some\ path"#,
hbs.render_template(r#"{{replace "some/path" "/" "\\ " }}"#, &())
.unwrap()
);
+ assert_eq!(
+ r#"some\ path"#,
+ hbs.render_template(r#"{{replace 'some/path' '/' '\\ ' }}"#, &())
+ .unwrap()
+ );
assert_eq!(
r#"some\path"#,
hbs.render_template(r#"{{replace "some/path" "/" "\\" }}"#, &())
.unwrap()
);
+ assert_eq!(
+ r#"some\path"#,
+ hbs.render_template(r#"{{replace 'some/path' '/' '\\' }}"#, &())
+ .unwrap()
+ );
+
+ assert_eq!(
+ r#"double-quoted \ 'with' "nesting""#,
+ hbs.render_template(r#"{{echo "double-quoted \\ 'with' \"nesting\""}}"#, &())
+ .unwrap()
+ );
+ assert_eq!(
+ r#"single-quoted \ 'with' "nesting""#,
+ hbs.render_template(r#"{{echo 'single-quoted \\ \'with\' "nesting"'}}"#, &())
+ .unwrap()
+ );
}
#[test]