diff options
author | Håkon Hallingstad <hakon@yahooinc.com> | 2022-01-12 01:56:05 +0100 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahooinc.com> | 2022-01-12 01:56:05 +0100 |
commit | 7ccea370f74410ff989d13d5c0a17b002d967c9a (patch) | |
tree | 7313ae631b7a0310f75dc29ee4143d40623c1bd3 /node-admin | |
parent | 7b8e1bb28733e9d6cd4d5dd95e0306d6e256949b (diff) |
Test that snapshot preserves list element and variables
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateTest.java index 784afccabc9..fb5f8e74b73 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateTest.java @@ -73,4 +73,19 @@ public class TemplateTest { assertEquals("if body\n", template.snapshot().set("cond", true).render()); assertEquals("else body\n", template.snapshot().set("cond", false).render()); } + + @Test + void verifySnapshotPreservesList() { + var template = Template.from("%{list foo}hello %{=area}%{end}"); + template.add("foo") + .set("area", "world"); + + assertEquals("hello world", template.render()); + assertEquals("hello world", template.snapshot().render()); + + Template snapshot = template.snapshot(); + snapshot.add("foo") + .set("area", "Norway"); + assertEquals("hello worldhello Norway", snapshot.render()); + } } |