cmd/hclspecsuite: Generate correct ranges in diagnostic-diagnostics
We were taking a pointer to a for loop iterator variable and thus capturing the final iteration value rather than each one separately. By using the .Ptr() method instead, we force a copy of the range which we then take a pointer to.
This commit is contained in:
parent
e8dbb16dbc
commit
2934d2f033
@ -283,7 +283,7 @@ func (r *Runner) runTestInput(specFilename, inputFilename string, tf *TestFile)
|
|||||||
"No %s diagnostic was expected %s. The unexpected diagnostic was shown above.",
|
"No %s diagnostic was expected %s. The unexpected diagnostic was shown above.",
|
||||||
severityString(gotEntry.Severity), rangeString(gotEntry.Range),
|
severityString(gotEntry.Severity), rangeString(gotEntry.Range),
|
||||||
),
|
),
|
||||||
Subject: &gotEntry.Range,
|
Subject: gotEntry.Range.Ptr(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,7 +297,7 @@ func (r *Runner) runTestInput(specFilename, inputFilename string, tf *TestFile)
|
|||||||
"No %s diagnostic was generated %s.",
|
"No %s diagnostic was generated %s.",
|
||||||
severityString(wantEntry.Severity), rangeString(wantEntry.Range),
|
severityString(wantEntry.Severity), rangeString(wantEntry.Range),
|
||||||
),
|
),
|
||||||
Subject: &declRange,
|
Subject: declRange.Ptr(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user