зеркало из https://github.com/mislav/hub.git
25 строки
456 B
Go
25 строки
456 B
Go
package commands
|
|
|
|
import (
|
|
"bufio"
|
|
"github.com/bmizerany/assert"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestReadTitleAndBody(t *testing.T) {
|
|
message := `A title
|
|
A title continues
|
|
|
|
A body
|
|
A body continues
|
|
# comment
|
|
`
|
|
r := strings.NewReader(message)
|
|
reader := bufio.NewReader(r)
|
|
title, body, err := readTitleAndBodyFrom(reader)
|
|
assert.Equal(t, nil, err)
|
|
assert.Equal(t, "A title A title continues", title)
|
|
assert.Equal(t, "A body\nA body continues", body)
|
|
}
|