Closed samanhappy closed 1 month ago
I was testing our project on Darwin/arm64, but there were some test failures with the following example log:
Darwin/arm64
=== RUN TestTwilio nexmo_test.go:61: Error Trace: /Users/runner/work/easeprobe/easeprobe/notify/sms/nexmo/nexmo_test.go:36 /Users/runner/work/easeprobe/easeprobe/notify/sms/nexmo/nexmo_test.go:61 /Users/runner/work/easeprobe/easeprobe/notify/sms/nexmo/nexmo_test.go:87 Error: An error is expected but got nil. Test: TestTwilio --- FAIL: TestTwilio (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x1047c45a8]
Almost all errors occurred when calling assert.Error like here.
assert.Error
func assertError(t *testing.T, err error, msg string) { t.Helper() assert.Error(t, err) // Line 36 assert.Equal(t, msg, err.Error()) }
I'm not sure if this was caused by testify. Does testify support Darwin/arm64? Can you guys help to check it?
testify
err is nil, so calling err.Error() panics, this is expected Go behavior You might want to use require.Error(t, err) so that the test stops if err is nil, or use the boolean returned by assert.Error
err
nil
err.Error()
require.Error(t, err)
I was testing our project on
Darwin/arm64
, but there were some test failures with the following example log:Almost all errors occurred when calling
assert.Error
like here.I'm not sure if this was caused by
testify
. Doestestify
supportDarwin/arm64
? Can you guys help to check it?