testing.assertMatches() 函数
testing.assertMatches()
测试字符串是否与给定的正则表达式匹配。
函数类型签名
(got: string, want: regexp) => stream[{v: string, _diff: string}]
有关更多信息,请参阅 函数类型签名。
参数
got
(必需) 要测试的值。
want
(必需) 要测试的正则表达式。
示例
测试两个值是否相等
import "internal/testing"
testing.assertMatches(got: "123", want: /12/)
此页内容对您有帮助吗?
感谢您的反馈!