Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
/ setupfiles-go Public archive

Create files and directories easily for tests in Go

License

Notifications You must be signed in to change notification settings

itchyny/setupfiles-go

Repository files navigation

setupfiles-go

Create files and directories easily for tests in Go.

When we setup sample files and directories for testing, we have to create the base directory, write files and catch errors. Doing these things is not what we have to care in testing. Using this setupfiles package, you can pass a recipe for what the file contents and directory structure should be to the library and it creates the files and directories.

Usage

dir, err := setupfiles.CreateTemp("test-setupfiles-sample", `
bar.txt
  bar
  contents
  here

baz.txt -> foo/qux.txt

foo/qux.txt
  qux contents

dir/
`)
if err != nil {
  t.Fatal(err)
}
defer os.RemoveAll(dir)

Bug Tracker

Report bug at Issues・itchyny/setupfiles-go - GitHub.

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

About

Create files and directories easily for tests in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published