Skip to content

Commit

Permalink
Delete reflect.DeepEqual() from unit test code
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed May 2, 2023
1 parent e2aea95 commit 6ad20f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmd/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"io"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
"testing"
Expand Down Expand Up @@ -105,8 +104,9 @@ func Test_validPkgInfo(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := validPkgInfo(tt.args.pkgs); !reflect.DeepEqual(got, tt.want) {
t.Errorf("validPkgInfo() = %v, want %v", got, tt.want)
got := validPkgInfo(tt.args.pkgs)
if diff := cmp.Diff(tt.want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
}
Expand Down
11 changes: 6 additions & 5 deletions cmd/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"io"
"os"
"reflect"
"runtime"
"strings"
"testing"
Expand Down Expand Up @@ -165,8 +164,9 @@ func Test_extractUserSpecifyPkg(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := extractUserSpecifyPkg(tt.args.pkgs, tt.args.targets); !reflect.DeepEqual(got, tt.want) {
t.Errorf("extractUserSpecifyPkg() = %v, want %v", got, tt.want)
got := extractUserSpecifyPkg(tt.args.pkgs, tt.args.targets)
if diff := cmp.Diff(tt.want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
}
Expand Down Expand Up @@ -253,8 +253,9 @@ func Test_excludeUserSpecifiedPkg(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := excludePkgs(tt.args.excludePkgList, tt.args.pkgs); !reflect.DeepEqual(got, tt.want) {
t.Errorf("extractUserSpecifyPkg() = %v, want %v", got, tt.want)
got := excludePkgs(tt.args.excludePkgList, tt.args.pkgs)
if diff := cmp.Diff(tt.want, got); diff != "" {
t.Errorf("value is mismatch (-want +got):\n%s", diff)
}
})
}
Expand Down

0 comments on commit 6ad20f1

Please sign in to comment.