optimize Fatalf with the expectedError

Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
This commit is contained in:
lixiaobing10051267 2017-01-05 12:32:19 +08:00
parent 4617b66c90
commit 6305817184

View file

@ -195,10 +195,11 @@ func TestResumableRequestReaderWithServerDoesntSupportByteRanges(t *testing.T) {
}
defer resreq.Close()
expectedError := "the server doesn't support byte ranges"
buf := make([]byte, 2)
_, err = resreq.Read(buf)
if err == nil || err.Error() != "the server doesn't support byte ranges" {
t.Fatalf("Expected an error 'the server doesn't support byte ranges', got %v", err)
if err == nil || err.Error() != expectedError {
t.Fatalf("Expected an error '%s', got %v", expectedError, err)
}
}