lint tests
This commit is contained in:
parent
a9a69a5728
commit
87bf394536
|
@ -201,12 +201,12 @@ func TestReceiverAndSyntaxErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var readerError = errors.New("error")
|
var errReader = errors.New("error")
|
||||||
|
|
||||||
type defectiveReader struct{}
|
type defectiveReader struct{}
|
||||||
|
|
||||||
func (d defectiveReader) Read(buf []byte) (int, error) {
|
func (d defectiveReader) Read(buf []byte) (int, error) {
|
||||||
return 0, readerError
|
return 0, errReader
|
||||||
}
|
}
|
||||||
func TestReadErrors(t *testing.T) {
|
func TestReadErrors(t *testing.T) {
|
||||||
|
|
||||||
|
@ -221,8 +221,8 @@ func TestReadErrors(t *testing.T) {
|
||||||
t.Fatalf("expected error")
|
t.Fatalf("expected error")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err.Error() != (&LineError{0, readerError}).Error() {
|
if err.Error() != (&LineError{0, errReader}).Error() {
|
||||||
t.Fatalf("expected error <%s>, got <%s>", &LineError{0, readerError}, err)
|
t.Fatalf("expected error <%s>, got <%s>", &LineError{0, errReader}, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,12 +167,12 @@ func TestDefaultIndent(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var writerError = errors.New("error")
|
var errWriter = errors.New("error")
|
||||||
|
|
||||||
type defectiveWriter struct{}
|
type defectiveWriter struct{}
|
||||||
|
|
||||||
func (d defectiveWriter) Write(buf []byte) (int, error) {
|
func (d defectiveWriter) Write(buf []byte) (int, error) {
|
||||||
return 0, writerError
|
return 0, errWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWriteError(t *testing.T) {
|
func TestWriteError(t *testing.T) {
|
||||||
|
@ -191,8 +191,8 @@ func TestWriteError(t *testing.T) {
|
||||||
|
|
||||||
// encode back to writer
|
// encode back to writer
|
||||||
encoder := NewEncoder(w)
|
encoder := NewEncoder(w)
|
||||||
if err := encoder.Encode(receiver); err != writerError {
|
if err := encoder.Encode(receiver); err != errWriter {
|
||||||
t.Fatalf("expected error <%s>, got <%s>", writerError, err)
|
t.Fatalf("expected error <%s>, got <%s>", errWriter, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue