func doLineReaderTest(counts []int, t *testing.T) {
	c := newMockConn(counts)
	r := NewIRCReader(c)
	var readCounts []int
	for {
		line, err := r.ReadLine()
		if err == nil {
			readCounts = append(readCounts, len(line))
		} else if err == io.EOF {
			break
		} else {
			panic(err)
		}
	}
	if !reflect.DeepEqual(counts, readCounts) {
		t.Errorf("expected %#v, got %#v", counts, readCounts)
	}
}
construct a mock reader with some number of \n-terminated lines,
verify that IRCStreamConn can read and split them as expected
package ircreader
import (
	"fmt"
	"io"
	"math/rand"
	"reflect"
	"testing"
	"time"
)
type mockConn struct {
	counts []int
}
func min(i, j int) (m int) {
	if i < j {
		return i
	} else {
		return j
	}
}
func (c *mockConn) Read(b []byte) (n int, err error) {
	for len(b) > 0 {
		if len(c.counts) == 0 {
			return n, io.EOF
		}
		if c.counts[0] == 0 {
			b[0] = '\n'
			c.counts = c.counts[1:]
			b = b[1:]
			n += 1
			continue
		}
		size := min(c.counts[0], len(b))
		for i := 0; i < size; i++ {
			b[i] = 'a'
		}
		c.counts[0] -= size
		b = b[size:]
		n += size
	}
	return n, nil
}
func (c *mockConn) Write(b []byte) (n int, err error) {
	return
}
func (c *mockConn) Close() error {
	c.counts = nil
	return nil
}
func newMockConn(counts []int) *mockConn {
	cpCounts := make([]int, len(counts))
	copy(cpCounts, counts)
	return &mockConn{
		counts: cpCounts,
	}
}