You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
378 B
Go

package main
import (
"bytes"
"testing"
)
func TestGreet(t *testing.T) {
// The Buffer type from the bytes package implements the Writer interface, because it has the method Write(p []byte) (n int, err error)
buffer := bytes.Buffer{}
Greet(&buffer, "Chris")
got := buffer.String()
want := "Hello, Chris"
if got != want {
t.Errorf("got %q want %q", got, want)
}
}