// file_name: strings_test.go (这里样例代码放入strings_test.go文件中)
// 文件名需要以 _test 结尾
package strings_test
import (
"strings"
"testing"
)
// 函数名以Test开头,参数为test.T。如果是benchmark用例,则函数名以Benchmark开头
func TestIndex(t *testing.T) {
const s, sep, want = "chicken", "ken", 4
got := strings.Index(s, sep)
if got != want {
t.Errorf("Index(%q,%q) = %v; want %v", s, sep, got, want)
}
}