Collection of small functions to shorten Go test cases.
Requires Go 1.2 due to the use of testing.TB
. If needed, replace with *testing.T
at the cost of not being usable in benchmarks.
package foo import ( "github.com/maruel/ut" "log" "strconv" "testing" ) func TestItoa(t *testing.T) { ut.AssertEqual(t, "42", strconv.Itoa(42)) } func TestItoaDataListDriven(t *testing.T) { data := []struct { in int expected string }{ {9, "9"}, {11, "11"}, } for i, item := range data { ut.AssertEqualIndex(t, i, item.expected, strconv.Itoa(item.in)) } } func TestWithLog(t *testing.T) { out := ut.NewWriter(t) defer out.Close() logger := log.New(out, "Foo:", 0) // These will be included in the test output only if the test case fails. logger.Printf("Q: What is the answer to life the universe and everything?") logger.Printf("A: %d", 42) }
灰指甲是什么原因引起的 | 西多士是什么 | 什么是更年期 | 梦见吃西红柿是什么意思 | 为什么当警察 |
盗汗吃什么药 | anca是什么检查 | 致密是什么意思 | 热得像什么 | 一加一为什么等于二 |
银行降息意味着什么 | 桥本氏甲状腺炎吃什么药 | 吃什么降三高最好 | kodice是什么牌子 | 吃什么补心脏供血不足 |
人老是放屁是什么原因 | 自我安慰是什么意思 | 黑户什么意思 | 君子什么意思 | 肺结节吃什么中成药 |
发烧有什么症状hcv8jop9ns5r.cn | hpv检查挂什么科hcv7jop9ns1r.cn | 血脂高胆固醇高吃什么食物最好hcv9jop2ns2r.cn | 童养媳是什么意思hcv8jop5ns4r.cn | 农历三月三是什么日子hcv8jop1ns5r.cn |
扁平疣是什么原因引起的hcv9jop3ns4r.cn | 家门不幸是什么意思hcv9jop7ns2r.cn | 什么叫血压hcv8jop1ns4r.cn | yair是什么牌子的空调hcv8jop1ns3r.cn | 经常耳鸣是为什么hcv8jop4ns6r.cn |
啃手指甲是什么毛病hcv8jop5ns1r.cn | 九月十七日是什么星座hcv9jop3ns5r.cn | 为什么一热脸就特别红hcv9jop0ns3r.cn | 王加申念什么luyiluode.com | 双侧中耳乳突炎是什么意思hcv9jop7ns4r.cn |
强势的人有什么特点huizhijixie.com | ipada1474是什么型号hcv9jop5ns2r.cn | 生命之水是什么hcv7jop9ns4r.cn | 灰指甲用什么药hcv7jop9ns0r.cn | 疱疹挂号挂什么科室zhongyiyatai.com |