mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Use tmpdir for tests
This commit is contained in:
@ -3,6 +3,7 @@ package oscommands
|
|||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -145,7 +146,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) {
|
|||||||
|
|
||||||
scenarios := []scenario{
|
scenarios := []scenario{
|
||||||
{
|
{
|
||||||
"testFile",
|
filepath.Join(os.TempDir(), "testFile"),
|
||||||
func(path string) {
|
func(path string) {
|
||||||
if err := ioutil.WriteFile(path, []byte("hello"), 0o600); err != nil {
|
if err := ioutil.WriteFile(path, []byte("hello"), 0o600); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -153,7 +154,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"testFileWithNewline",
|
filepath.Join(os.TempDir(), "testFileWithNewline"),
|
||||||
func(path string) {
|
func(path string) {
|
||||||
if err := ioutil.WriteFile(path, []byte("hello\n"), 0o600); err != nil {
|
if err := ioutil.WriteFile(path, []byte("hello\n"), 0o600); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Reference in New Issue
Block a user