ax(node): remove banned fmt import from protocol_test.go
Replace fmt.Errorf with a local testErr type to eliminate the banned fmt import. The type carries its own usage example comment per AX Principle 2. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
7396ef0253
commit
b0dcb18d76
1 changed files with 7 additions and 2 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -153,8 +152,14 @@ func TestConvenienceFunctions(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// testErr is a plain error type used to verify behaviour with non-ProtocolError values.
|
||||
// err := &testErr{"context: operation failed"}
|
||||
type testErr struct{ message string }
|
||||
|
||||
func (e *testErr) Error() string { return e.message }
|
||||
|
||||
func TestGetProtocolErrorCode_NonProtocolError(t *testing.T) {
|
||||
err := fmt.Errorf("regular error")
|
||||
err := &testErr{"regular error"}
|
||||
if GetProtocolErrorCode(err) != 0 {
|
||||
t.Error("Expected 0 for non-ProtocolError")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue