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.
learn_golang/ch5/func_thing_test.go

14 lines
408 B
Go

package main
import "testing"
// The *testing.T syntax is used in Golang unit tests because it allows you to access the methods of the testing.T object without having to dereference the pointer. This makes the code more concise and easier to read.
func TestAddStuff(t *testing.T) {
expected := 3
actual := AddStuff(1, 3)
if expected != actual {
t.Errorf("Expected %d, got %d", expected, actual)
}
}