testing.assertMatches() 函数
testing.assertMatches() 测试一个字符串是否匹配给定的正则表达式。
函数类型签名
(got: string, want: regexp) => stream[{v: string, _diff: string}]
有关更多信息,请参见 Function type signatures。
参数
获得
(必需) 测试的值。
想要
(必填) 用于测试的正则表达式。
示例
测试两个值是否相等
import "internal/testing"
testing.assertMatches(got: "123", want: /12/)