- }()
- if msg, ok := <-logChan; ok {
- t.Fatalf("Expected channel to close, got %s", msg)
+ receivedBytes = append(receivedBytes, line...)
+ }
+ if bytes.Compare(receivedBytes, sentBytes) != 0 {
+ t.Fatalf("sent %d bytes, got %d different bytes", len(sentBytes), len(receivedBytes))
+ }
+
+ if after, err := logBuf.ReadBytes('\n'); err != nil || string(after) != "after\n" {
+ t.Fatalf("\"after\n\" not received (got \"%s\", %s)", after, err)
+ }
+
+ select {
+ case <-time.After(time.Second):
+ t.Fatal("Timeout")
+ case <-copied:
+ // Done.