Skip to content

Commit 291c353

Browse files
committed
bake: TestEmptyVariable
Signed-off-by: CrazyMax <[email protected]>
1 parent 3c0f5c5 commit 291c353

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bake/hcl_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,20 @@ target "two" {
16221622
require.Equal(t, map[string]*string{"b": ptrstr("pre-jkl")}, c.Targets[1].Args)
16231623
}
16241624

1625+
func TestEmptyVariable(t *testing.T) {
1626+
dt := []byte(`
1627+
variable "FOO" {}
1628+
target "default" {
1629+
args = {
1630+
foo = equal(FOO, "")
1631+
}
1632+
}`)
1633+
c, err := ParseFile(dt, "docker-bake.hcl")
1634+
require.NoError(t, err)
1635+
require.Equal(t, 1, len(c.Targets))
1636+
require.Equal(t, "true", *c.Targets[0].Args["foo"])
1637+
}
1638+
16251639
func TestEmptyVariableJSON(t *testing.T) {
16261640
dt := []byte(`{
16271641
"variable": {

0 commit comments

Comments
 (0)