From aa6de16c9f1fd5ab40e0d26c1c01a04667936408 Mon Sep 17 00:00:00 2001 From: Rex Morgan Date: Sat, 20 Jun 2026 08:24:23 -0400 Subject: [PATCH] test: add regression test for named args in partial inside nested #each (issue #455) Verifies that {{> myPartial arg1=value1 arg2=value2}} works correctly inside a nested {{#each}} loop without throwing ArgumentOutOfRangeException. The existing #422 fix in BindingContext.PopulateHash already covers this case. Co-Authored-By: Claude Sonnet 4.6 --- .../Handlebars.Test/Issues/Issue455Tests.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 source/Handlebars.Test/Issues/Issue455Tests.cs diff --git a/source/Handlebars.Test/Issues/Issue455Tests.cs b/source/Handlebars.Test/Issues/Issue455Tests.cs new file mode 100644 index 00000000..17dad130 --- /dev/null +++ b/source/Handlebars.Test/Issues/Issue455Tests.cs @@ -0,0 +1,24 @@ +using Xunit; + +namespace HandlebarsDotNet.Test +{ + public class Issue455Tests + { + // issue: https://github.com/Handlebars-Net/Handlebars.Net/issues/455 + [Fact] + public void Issue455_NamedArgsInPartialInsideNestedEach() + { + var h = Handlebars.Create(); + h.RegisterTemplate("myPartial", "{{arg1}}-{{arg2}} "); + var template = h.Compile( + "{{#each items}}{{#each nested}}{{> myPartial arg1=value1 arg2=value2}}{{/each}}{{/each}}"); + var data = new + { + items = new[] { new { nested = new[] { new { value1 = "A", value2 = "B" }, new { value1 = "C", value2 = "D" } } } } + }; + var result = template(data); + Assert.Contains("A-B", result); + Assert.Contains("C-D", result); + } + } +}