NOTE
4.1 unittest
Go unit tests live in files ending in _test.go. These notes use test code to record assertions, execution, and test organization.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What It Is
Unit testing.
2. Usage
- Filename:
xxx_test.go - Import
testing - The function name must be
TestXXX
package array1
import (
"fmt"
"reflect"
"testing"
)
func TestArray1(t *testing.T) {
slices := []string{"1", "2", "3"}
fmt.Println(slices)
}
- Run
go test .
3. References
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub