Просмотр исходного кода

assert buffer is empty at end of unit tests

Mike 2 лет назад
Родитель
Сommit
b66dff32a9
4 измененных файлов с 7 добавлено и 0 удалено
  1. 2 0
      server/bucp_test.go
  2. 2 0
      server/feedbag_test.go
  3. 2 0
      server/icbm_test.go
  4. 1 0
      server/locate_test.go

+ 2 - 0
server/bucp_test.go

@@ -200,6 +200,7 @@ func TestReceiveAndSendBUCPLoginRequest(t *testing.T) {
 			actual := oscar.SNAC_0x17_0x03_BUCPLoginResponse{}
 			assert.NoError(t, oscar.Unmarshal(&actual, output))
 			assert.Equal(t, tc.expectSNACBody, actual)
+			assert.Equalf(t, 0, output.Len(), "the rest of the buffer is unread")
 		})
 	}
 }
@@ -360,6 +361,7 @@ func TestReceiveAndSendAuthChallenge(t *testing.T) {
 			default:
 				t.Fatalf("unexpected output SNAC type")
 			}
+			assert.Equalf(t, 0, output.Len(), "the rest of the buffer is unread")
 		})
 	}
 }

+ 2 - 0
server/feedbag_test.go

@@ -109,6 +109,7 @@ func TestReceiveAndSendFeedbagQuery(t *testing.T) {
 			actual := oscar.SNAC_0x13_0x06_FeedbagReply{}
 			assert.NoError(t, oscar.Unmarshal(&actual, output))
 			assert.Equal(t, tc.expectSNACBody, actual)
+			assert.Equalf(t, 0, output.Len(), "the rest of the buffer is unread")
 		})
 	}
 }
@@ -256,6 +257,7 @@ func TestReceiveAndSendFeedbagQueryIfModified(t *testing.T) {
 			default:
 				t.Fatalf("unexpected output SNAC type")
 			}
+			assert.Equalf(t, 0, output.Len(), "the rest of the buffer is unread")
 		})
 	}
 }

+ 2 - 0
server/icbm_test.go

@@ -265,6 +265,7 @@ func TestSendAndReceiveChannelMsgTohost(t *testing.T) {
 			default:
 				t.Fatalf("unexpected output SNAC type")
 			}
+			assert.Equalf(t, 0, output.Len(), "the rest of the buffer is unread")
 		})
 	}
 }
@@ -600,6 +601,7 @@ func TestSendAndReceiveEvilRequest(t *testing.T) {
 			default:
 				t.Fatalf("unexpected output SNAC type")
 			}
+			assert.Equalf(t, 0, output.Len(), "the rest of the buffer is unread")
 		})
 	}
 }

+ 1 - 0
server/locate_test.go

@@ -332,6 +332,7 @@ func TestSendAndReceiveUserInfoQuery2(t *testing.T) {
 			default:
 				t.Fatalf("unexpected output SNAC type")
 			}
+			assert.Equalf(t, 0, output.Len(), "the rest of the buffer is unread")
 		})
 	}
 }