summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars/tests/escape.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/handlebars/tests/escape.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 \ &#x27;with&#x27; &quot;nesting&quot;"#,
+ hbs.render_template(r#"{{echo "double-quoted \\ 'with' \"nesting\""}}"#, &())
+ .unwrap()
+ );
+ assert_eq!(
+ r#"single-quoted \ &#x27;with&#x27; &quot;nesting&quot;"#,
+ hbs.render_template(r#"{{echo 'single-quoted \\ \'with\' "nesting"'}}"#, &())
+ .unwrap()
+ );
}
#[test]