From 58a32b60bc2bba200ebe0092ae6656404f98d9c5 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Tue, 19 Dec 2023 20:37:54 +0800 Subject: [PATCH] test: add test case for trimming --- tests/escape.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/escape.rs b/tests/escape.rs index 2b9512290..8e85d47af 100644 --- a/tests/escape.rs +++ b/tests/escape.rs @@ -106,3 +106,17 @@ fn test_triple_bracket_expression_471() { .unwrap() ); } + +#[test] +fn test_trimmed_nonescaped_variable() { + let mut handlebars = Handlebars::new(); + handlebars + .register_partial("system", "system: {{~{system}~}}") + .unwrap(); + + let output = handlebars + .render_template("{{>system system=\"hello\" prompt=\" world\"}}", &()) + .unwrap(); + + assert_eq!(output, "system:hello"); +}