caarlos0 / Testfs
Licence: mit
A simple fs.FS implementation to be used inside tests.
Stars: ✭ 27
Labels
Projects that are alternatives of or similar to Testfs
Knpgaufrettebundle
Easily use Gaufrette in your Symfony projects.
Stars: ✭ 646 (+2292.59%)
Mutual labels: filesystem
Finder
🔍 Finder: find files and directories with an intuitive API.
Stars: ✭ 765 (+2733.33%)
Mutual labels: filesystem
Node Ntfs
Windows NT File System (NTFS) file system driver
Stars: ✭ 18 (-33.33%)
Mutual labels: filesystem
Memacs
What did I do on February 14th 2007? Visualize your (digital) life in Org-mode
Stars: ✭ 711 (+2533.33%)
Mutual labels: filesystem
Distribyted
📂 ➡️ 📺 🎶 🎮 Torrent client with on-demand file downloading as a filesystem.
Stars: ✭ 791 (+2829.63%)
Mutual labels: filesystem
Fuse Copyfs
CopyFS is the copy-on-write (COW) versioned filesystem for FUSE. Years ago I added features to CopyFS 1.0, then 1.0.1 came out and I never bothered to forward-port my changes. Now I have. Master is 1.3.1M, which is CopyFS 1.0.1 + 1.3M
Stars: ✭ 24 (-11.11%)
Mutual labels: filesystem
Fuse Rs
Rust library for filesystems in userspace (FUSE)
Stars: ✭ 735 (+2622.22%)
Mutual labels: filesystem
Macosx Vfs Isolation Filter
A MacOS VFS isolation layer to redirect file I/O operations.
Stars: ✭ 18 (-33.33%)
Mutual labels: filesystem
Tiny Glob
Super tiny and ~350% faster alternative to node-glob
Stars: ✭ 710 (+2529.63%)
Mutual labels: filesystem
Simplefs
A simple, kernel-space, on-disk filesystem from the scratch
Stars: ✭ 831 (+2977.78%)
Mutual labels: filesystem
Open Shell Book
开源书籍:《Shell 编程范例》,面向操作对象学 Shell!本书作者发布了《360°剖析 Linux ELF》视频课程,欢迎订阅:https://www.cctalk.com/m/group/88089283
Stars: ✭ 666 (+2366.67%)
Mutual labels: filesystem
Tagstore
a research software; a fun way of storing files & folders on your local disk drive; tagging
Stars: ✭ 18 (-33.33%)
Mutual labels: filesystem
Fsmon
monitor filesystem on iOS / OS X / Android / FirefoxOS / Linux
Stars: ✭ 635 (+2251.85%)
Mutual labels: filesystem
Fdir
⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
Stars: ✭ 777 (+2777.78%)
Mutual labels: filesystem
Appfolder
🗂 Never use NSSearchPathForDirectoriesInDomains again
Stars: ✭ 928 (+3337.04%)
Mutual labels: filesystem
testfs
A simple fs.FS
which is contained in a test (using testing.TB
's TempDir()
)
and with a few helper methods.
PS: This lib only works on Go 1.16+.
Example
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.DirEntry, err error) error { return nil })
// and read files of course:
bts, _ := fs.ReadFile(tmpfs, testfile)
fmt.Println(string(bts))
}
Why
The idea is to able to test code that use a fs.FS
, without having to,
for example, commit a bunch of files inside testdata
and without using
in-memory implementation that might not do the same thing as a real FS.
This is a real FS, it only limits itself to a temporary directory and cleans after itself once the test is done. You also get a couple of helper methods to create the structure you need.
Other options
If you don't mind testing against an in-memory implementation, the native
fstest.MemFS
is a good option.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].