From f358f185e00bf92bf2095b1eebcc4c950588488d Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sat, 6 May 2017 12:49:39 -0400 Subject: Fixing bug with 'has' and 'datasource' around referencing sub-maps in nested maps Signed-off-by: Dave Henderson --- gomplate_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gomplate_test.go') diff --git a/gomplate_test.go b/gomplate_test.go index e35e6660..1d55751b 100644 --- a/gomplate_test.go +++ b/gomplate_test.go @@ -125,8 +125,9 @@ func TestHasTemplate(t *testing.T) { "has": ty.Has, }, } - assert.Equal(t, "true", testTemplate(g, `{{has ("foo: true" | yaml) "foo"}}`)) - assert.Equal(t, "false", testTemplate(g, `{{has ("foo: true" | yaml) "bar"}}`)) + assert.Equal(t, "true", testTemplate(g, `{{has ("foo:\n bar: true" | yaml) "foo"}}`)) + assert.Equal(t, "true", testTemplate(g, `{{has ("foo:\n bar: true" | yaml).foo "bar"}}`)) + assert.Equal(t, "false", testTemplate(g, `{{has ("foo: true" | yaml) "bah"}}`)) tmpl := `{{- $data := yaml "foo: bar\nbaz: qux\n" }} {{- if (has $data "baz") }} {{- $data.baz }} -- cgit v1.2.3