mirror of
https://github.com/hashicorp/terraform.git
synced 2026-02-20 00:13:30 -05:00
we can't compare location if either are nil
This commit is contained in:
parent
c6c21a89a1
commit
291d26ce19
2 changed files with 31 additions and 3 deletions
|
|
@ -733,6 +733,35 @@ func TestAppendWithoutDuplicates(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
"hcl.Diagnostic no-location": {
|
||||
// Extra can contain anything, and we don't know how to compare
|
||||
// those values, so we can't dedupe them
|
||||
func(diags Diagnostics) Diagnostics {
|
||||
diags = diags.Append(&hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: "Something bad happened",
|
||||
Detail: "It was really, really bad.",
|
||||
})
|
||||
diags = diags.Append(&hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: "Something bad happened",
|
||||
Detail: "It was really, really bad.",
|
||||
})
|
||||
return diags
|
||||
},
|
||||
[]diagFlat{
|
||||
{
|
||||
Severity: Error,
|
||||
Summary: "Something bad happened",
|
||||
Detail: "It was really, really bad.",
|
||||
},
|
||||
{
|
||||
Severity: Error,
|
||||
Summary: "Something bad happened",
|
||||
Detail: "It was really, really bad.",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, test := range tests {
|
||||
|
|
@ -756,9 +785,7 @@ func TestAppendWithoutDuplicates(t *testing.T) {
|
|||
}
|
||||
|
||||
if !reflect.DeepEqual(got, test.Want) {
|
||||
// t.Errorf("wrong result\ngot: %swant: %s", spew.Sdump(got), spew.Sdump(test.Want))
|
||||
t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.Want)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,8 +85,9 @@ func (d hclDiagnostic) Equals(otherDiag ComparableDiagnostic) bool {
|
|||
|
||||
func hclRangeEquals(l, r *hcl.Range) bool {
|
||||
if l == nil || r == nil {
|
||||
return l == r
|
||||
return false
|
||||
}
|
||||
|
||||
if l.Filename != r.Filename {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue