@@ -86,9 +86,16 @@ func testPutAttribute(t *testing.T, record attributable) {
8686
8787 // Add a negative index to the record.
8888 record .AttributeIndices ().Append (- 1 )
89- // Try putting a new attribute, make sure it fails, and that table/indices didn't change.
9089 tableLen := table .Len ()
9190 indicesLen := record .AttributeIndices ().Len ()
91+ // Try putting a new attribute, make sure it fails, and that table/indices didn't change.
92+ require .Error (t , PutAttribute (table , record , "newKey" , pcommon .NewValueStr ("value" )))
93+ require .Equal (t , tableLen , table .Len ())
94+ require .Equal (t , indicesLen , record .AttributeIndices ().Len ())
95+
96+ // Set the last index to the table length, which is out of range.
97+ record .AttributeIndices ().SetAt (indicesLen - 1 , int32 (tableLen ))
98+ // Try putting a new attribute, make sure it fails, and that table/indices didn't change.
9299 require .Error (t , PutAttribute (table , record , "newKey" , pcommon .NewValueStr ("value" )))
93100 require .Equal (t , tableLen , table .Len ())
94101 require .Equal (t , indicesLen , record .AttributeIndices ().Len ())
0 commit comments