NOTE

4.1 unittest

1. What it is Unit testing 2. Usage - filename xxx_test.go - import testing - function name must be TestXXX - run - go test . 3. References

GoCreated Updated 1 min readhistorical

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

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub