Skip to content

Commit

Permalink
Replace deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2brain committed Jun 2, 2023
1 parent 2ed59d5 commit e3c91c6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions unarr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package unarr

import (
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand All @@ -28,7 +27,7 @@ func TestNewArchive(t *testing.T) {

func TestNewArchiveFromMemory(t *testing.T) {
for _, f := range files {
d, err := ioutil.ReadFile(filepath.Join("testdata", f))
d, err := os.ReadFile(filepath.Join("testdata", f))
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -292,7 +291,7 @@ func TestReadAll(t *testing.T) {

func TestReadAllFromMemory(t *testing.T) {
for _, e := range exts {
m, err := ioutil.ReadFile(filepath.Join("testdata", "test."+e))
m, err := os.ReadFile(filepath.Join("testdata", "test."+e))
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -321,7 +320,7 @@ func TestReadAllFromMemory(t *testing.T) {
}

func TestExtract(t *testing.T) {
tmpdir, err := ioutil.TempDir(os.TempDir(), "unarr")
tmpdir, err := os.MkdirTemp(os.TempDir(), "unarr")
if err != nil {
t.Error(err)
}
Expand All @@ -340,15 +339,15 @@ func TestExtract(t *testing.T) {
}

func TestExtractFromMemory(t *testing.T) {
tmpdir, err := ioutil.TempDir(os.TempDir(), "unarr")
tmpdir, err := os.MkdirTemp(os.TempDir(), "unarr")
if err != nil {
t.Error(err)
}

defer os.RemoveAll(tmpdir)

for _, f := range files {
data, err := ioutil.ReadFile(filepath.Join("testdata", f))
data, err := os.ReadFile(filepath.Join("testdata", f))
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -409,7 +408,7 @@ func TestNotValid(t *testing.T) {
}

func TestExtractCorrupted(t *testing.T) {
tmpdir, err := ioutil.TempDir(os.TempDir(), "unarr")
tmpdir, err := os.MkdirTemp(os.TempDir(), "unarr")
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit e3c91c6

Please sign in to comment.