16 lines
353 B
Go
16 lines
353 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// This file is named add_test.go by convention.
|
|
// The go test command will automatically detect this file and run it.
|
|
// All test files must be named *_test.go and all test functions must be named Test*.
|
|
|
|
// TestAdd is a test function
|
|
func TestAdd(t *testing.T) {
|
|
if add(1, 2) != 3 {
|
|
t.Error("Expected 3")
|
|
}
|
|
}
|