From 291c3535757c58eb562beb2c1784f3e1a5eea539 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 21 May 2025 16:15:30 +0200 Subject: [PATCH] bake: TestEmptyVariable Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- bake/hcl_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bake/hcl_test.go b/bake/hcl_test.go index ee52352e6..db1ca9c6c 100644 --- a/bake/hcl_test.go +++ b/bake/hcl_test.go @@ -1622,6 +1622,20 @@ target "two" { require.Equal(t, map[string]*string{"b": ptrstr("pre-jkl")}, c.Targets[1].Args) } +func TestEmptyVariable(t *testing.T) { + dt := []byte(` + variable "FOO" {} + target "default" { + args = { + foo = equal(FOO, "") + } + }`) + c, err := ParseFile(dt, "docker-bake.hcl") + require.NoError(t, err) + require.Equal(t, 1, len(c.Targets)) + require.Equal(t, "true", *c.Targets[0].Args["foo"]) +} + func TestEmptyVariableJSON(t *testing.T) { dt := []byte(`{ "variable": {