Skip to content

Commit

Permalink
fixup! tests: use os.IsNotExist instead of checking error string
Browse files Browse the repository at this point in the history
  • Loading branch information
fho committed Jan 9, 2024
1 parent 853212c commit 006f408
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/baur/inputresolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package baur

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -631,23 +632,23 @@ func TestResolveSymlink(t *testing.T) {
testdir: "directory_broken",
inputPath: "**",
validateFn: func(t *testing.T, err error, result []Input) {
require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err)
require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err)
require.Empty(t, result)
},
},
{
testdir: "file_broken",
inputPath: "symlink",
validateFn: func(t *testing.T, err error, result []Input) {
require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err)
require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err)
require.Empty(t, result)
},
},
{
testdir: "file_broken",
inputPath: "**",
validateFn: func(t *testing.T, err error, result []Input) {
require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err)
require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err)
require.Empty(t, result)
},
},
Expand Down Expand Up @@ -698,7 +699,7 @@ func TestResolveSymlink(t *testing.T) {
testdir: "symlinks",
inputPath: "directory_containing_broken_symlin**/**",
validateFn: func(t *testing.T, err error, _ []Input) {
require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err)
require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err)
},
},
}
Expand Down

0 comments on commit 006f408

Please sign in to comment.