go-by-test/greet/greet_test.go

18 lines
241 B
Go
Raw Normal View History

2024-09-17 14:12:39 +00:00
package greet
import (
"bytes"
"testing"
)
func TestGreet(t *testing.T) {
buffer := bytes.Buffer{}
Greet(&buffer, "Chris")
got := buffer.String()
want := "Hello, Chris"
if got != want {
t.Errorf("got %q want %q", got, want)
}
}