1 Star 0 Fork 0

liboxwz/dep

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
writer.go 590 Bytes
一键复制 编辑 原始数据 按行查看 历史
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package test
import (
"strings"
"testing"
"unicode"
)
// Writer adapts a testing.TB to the io.Writer interface
type Writer struct {
testing.TB
}
func (t Writer) Write(b []byte) (n int, err error) {
str := string(b)
if len(str) == 0 {
return 0, nil
}
for _, part := range strings.Split(str, "\n") {
str := strings.TrimRightFunc(part, unicode.IsSpace)
if len(str) != 0 {
t.Log(str)
}
}
return len(b), err
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liboxwz/dep.git
git@gitee.com:liboxwz/dep.git
liboxwz
dep
dep
v0.5.4

搜索帮助