psi/psi_test.go: made buildPmtWithMeta() safer and readable

This commit is contained in:
saxon 2019-01-20 21:58:23 +10:30
parent a24e4ecb81
commit 67d952c6a7
1 changed files with 5 additions and 5 deletions

View File

@ -367,9 +367,9 @@ func TestTrim(t *testing.T) {
// for pmts with time and location, as the location data field is 32 bytes, i.e. quite large
// to type out
func buildPmtWithMeta(tstStr string) []byte {
tmp := make([]byte, len(pmtWithMetaHead))
copy(tmp, pmtWithMetaHead)
pmt := append(tmp, tstStr...)
pmt = append(pmt, pmtWithMetaTail...)
return pmt
dst := make([]byte, len(pmtWithMetaHead)+32+len(pmtWithMetaTail))
copy(dst, pmtWithMetaHead)
copy(dst[len(pmtWithMetaHead):], tstStr)
copy(dst[len(pmtWithMetaHead)+32:], pmtWithMetaTail)
return dst
}