ax(ueps): replace abbreviated buf with buffer in writeTLV usage example comments
AX Principle 1 — predictable names over short names. Test comments showing writeTLV usage had buf (abbreviated) while the actual code used buffer (descriptive). Comments are usage examples that agents learn from; the name must match what an agent would write. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
3ed2453413
commit
eafd673d13
1 changed files with 5 additions and 5 deletions
|
|
@ -145,8 +145,8 @@ func TestPacket_MarshalAndSign_Ugly(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// writeTLV(buf, TagVersion, []byte{0x09})
|
||||
// // buf contains: [0x01, 0x01, 0x09]
|
||||
// writeTLV(buffer, TagVersion, []byte{0x09})
|
||||
// // buffer contains: [0x01, 0x01, 0x09]
|
||||
func TestPacket_writeTLV_Good(t *testing.T) {
|
||||
buffer := new(bytes.Buffer)
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ func TestPacket_writeTLV_Good(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// writeTLV(buf, TagPayload, bytes.Repeat([]byte("x"), 256))
|
||||
// writeTLV(buffer, TagPayload, bytes.Repeat([]byte("x"), 256))
|
||||
// // returns error: "TLV value too large for 1-byte length header"
|
||||
func TestPacket_writeTLV_Bad(t *testing.T) {
|
||||
buffer := new(bytes.Buffer)
|
||||
|
|
@ -183,8 +183,8 @@ func TestPacket_writeTLV_Bad(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// writeTLV(buf, TagIntent, []byte{})
|
||||
// // buf contains: [0x04, 0x00] (tag + zero length, no value bytes)
|
||||
// writeTLV(buffer, TagIntent, []byte{})
|
||||
// // buffer contains: [0x04, 0x00] (tag + zero length, no value bytes)
|
||||
func TestPacket_writeTLV_Ugly(t *testing.T) {
|
||||
buffer := new(bytes.Buffer)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue