提交 5ce2deb5 作者: Christopher Buesser

Test Fix: Nil error handling

In TestExternalUnmount, the Mount function is called which returns an
error which can be nil. The error type is then used in a comparison
where Error() is called on it. If the error is nil, this results in a
panic.

Added a if err != nil {} guard to make sure that Error() is not called
if the value is nil
 On branch go-test-fix
 Changes to be committed:
	modified:   fuse/node/mount_test.go
License: MIT
Signed-off-by: 's avatarChris Buesser <christopher.buesser@gmail.com>
上级 93806601
......@@ -64,9 +64,12 @@ func TestExternalUnmount(t *testing.T) {
mkdir(t, ipnsDir)
err = Mount(node, ipfsDir, ipnsDir)
if strings.Contains(err.Error(), "unable to check fuse version") || err == fuse.ErrOSXFUSENotFound {
t.Skip(err)
if err != nil {
if strings.Contains(err.Error(), "unable to check fuse version") || err == fuse.ErrOSXFUSENotFound {
t.Skip(err)
}
}
if err != nil {
t.Fatalf("error mounting: %v", err)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论