testfs:在测试中使用的简单fs.FS实现

时间:2021-05-09 04:53:32
【文件属性】:
文件名称:testfs:在测试中使用的简单fs.FS实现
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-09 04:53:32
testing golang filesystem Go 测试文件 一个简单的fs.FS ,包含在测试中(使用testing.TB的TempDir() ),并带有一些辅助方法。 PS:此库仅适用于Go 1.16+。 例子 func TestSomething ( t * testing. T ) { tmpfs := testfs . New ( t ) testfile := "foo/bar/foobar" _ = tmpfs . MkdirAll ( filepath . Dir ( testfile ), 0o764 ) _ = tmpfs . WriteFile ( testfile , [] byte ( "example" ), 0o644 ) // you can now use tmpfs as a fs.FS... // fs.WalkDir(tmpfs, ".", func(path string, d fs.
【文件预览】:
testfs-main
----.goreleaser.yml(21B)
----.gitignore(5B)
----go.mod(43B)
----testfs_test.go(2KB)
----LICENSE(1KB)
----.github()
--------workflows()
----README.md(1KB)
----testfs.go(2KB)

网友评论