terraform: Diff.Empty should be true for nil Diff
This commit is contained in:
parent
0fe51b334c
commit
50afee2a30
|
@ -72,6 +72,10 @@ func (d *Diff) RootModule() *ModuleDiff {
|
|||
|
||||
// Empty returns true if the diff has no changes.
|
||||
func (d *Diff) Empty() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, m := range d.Modules {
|
||||
if !m.Empty() {
|
||||
return false
|
||||
|
|
|
@ -7,7 +7,12 @@ import (
|
|||
)
|
||||
|
||||
func TestDiffEmpty(t *testing.T) {
|
||||
diff := new(Diff)
|
||||
var diff *Diff
|
||||
if !diff.Empty() {
|
||||
t.Fatal("should be empty")
|
||||
}
|
||||
|
||||
diff = new(Diff)
|
||||
if !diff.Empty() {
|
||||
t.Fatal("should be empty")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue