Skip to content

Commit

Permalink
add test case for filterTag function.
Browse files Browse the repository at this point in the history
  • Loading branch information
metacpp committed Apr 17, 2018
1 parent 044447f commit 0edbdaf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions azurerm/tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,22 @@ func TestExpandARMTags(t *testing.T) {
}
}
}

func TestFilterARMTags(t *testing.T) {
testData := make(map[string]*string)
valueData := [3]string{"value1", "value2", "value3"}

testData["key1"] = &valueData[0]
testData["key2"] = &valueData[1]
testData["key3"] = &valueData[2]

filtered := filterTags(testData, "key1", "key3", "")

if len(filtered) != 1 {
t.Fatalf("Expected 1 result in filtered tag map, got %d", len(filtered))
}

if filtered["key2"] != &valueData[1] {
t.Fatalf("Expected %v in filtered tag map, got %v", valueData[1], *filtered["key2"])
}
}

0 comments on commit 0edbdaf

Please sign in to comment.