/
abatalev
/
gitdiff2fly
Обзор
Документация
Войти
/
abatalev
/
gitdiff2fly
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
fs_test.go
22 строки
425 B
andrey
replace calls to the ReadFile and WriteFile functions from the io/ioutil package with functions from the os package
01 окт 2023, 13:44
01 окт 2023, 13:44
aa67190
Код
Авторство
О чём код?
package main import ( "os" "testing" "github.com/stretchr/testify/require" ) func TestCopy(t *testing.T) { defer os.Remove("a.txt") defer os.Remove("b.txt") fsSys := OsSystem{} if err0 := os.WriteFile("a.txt", []byte("a\nb"), 0600); err0 != nil { t.Fail() } err := fsSys.copy("a.txt", "b.txt") assertions := require.New(t) assertions.Nil(err) assertions.Equal([]string{"a", "b"}, fsSys.readFile("b.txt")) }