move testfiles into testdata dir

This commit is contained in:
Shawn Smith
2022-03-26 16:56:37 +09:00
parent a22b7c5858
commit a7a96b4141
19 changed files with 10 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ package check
import "testing" import "testing"
func TestPercentage(t *testing.T) { func TestPercentage(t *testing.T) {
g := License{"testfiles", []string{}} g := License{"testdata/testfiles", []string{}}
p, _, err := g.Percentage() p, _, err := g.Percentage()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@@ -6,18 +6,18 @@ import (
) )
func TestGoFiles(t *testing.T) { func TestGoFiles(t *testing.T) {
files, skipped, err := GoFiles("testfiles/") files, skipped, err := GoFiles("testdata/testfiles/")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
want := []string{"testfiles/a.go", "testfiles/b.go", "testfiles/c.go", "testfiles/d.go"} want := []string{"testdata/testfiles/a.go", "testdata/testfiles/b.go", "testdata/testfiles/c.go", "testdata/testfiles/d.go"}
if !reflect.DeepEqual(files, want) { if !reflect.DeepEqual(files, want) {
t.Errorf("GoFiles(%q) = %v, want %v", "testfiles/", files, want) t.Errorf("GoFiles(%q) = %v, want %v", "testdata/testfiles/", files, want)
} }
wantSkipped := []string{"testfiles/a.pb.go", "testfiles/a.pb.gw.go"} wantSkipped := []string{"testdata/testfiles/a.pb.go", "testdata/testfiles/a.pb.gw.go"}
if !reflect.DeepEqual(skipped, wantSkipped) { if !reflect.DeepEqual(skipped, wantSkipped) {
t.Errorf("GoFiles(%q) skipped = %v, want %v", "testfiles/", skipped, wantSkipped) t.Errorf("GoFiles(%q) skipped = %v, want %v", "testdata/testfiles/", skipped, wantSkipped)
} }
} }
@@ -30,16 +30,16 @@ var goToolTests = []struct {
failed []FileSummary failed []FileSummary
wantErr bool wantErr bool
}{ }{
{"go vet", "testfiles", []string{"testfiles/a.go", "testfiles/b.go", "testfiles/c.go"}, []string{"go", "vet"}, 1, []FileSummary{}, false}, {"go vet", "testdata/testfiles", []string{"testdata/testfiles/a.go", "testdata/testfiles/b.go", "testdata/testfiles/c.go"}, []string{"go", "vet"}, 1, []FileSummary{}, false},
{ {
"staticcheck", "staticcheck",
"testfiles/", "testdata/testfiles/",
[]string{"testfiles/a.go", "testfiles/b.go", "testfiles/c.go", "testfiles/d.go"}, []string{"testdata/testfiles/a.go", "testdata/testfiles/b.go", "testdata/testfiles/c.go", "testdata/testfiles/d.go"},
[]string{"staticcheck", "./..."}, []string{"staticcheck", "./..."},
0.75, 0.75,
[]FileSummary{ []FileSummary{
{ {
Filename: "testfiles/d.go", FileURL: "", Filename: "testdata/testfiles/d.go", FileURL: "",
Errors: []Error{ Errors: []Error{
{LineNumber: 8, ErrorString: " func foo is unused (U1000)"}, {LineNumber: 8, ErrorString: " func foo is unused (U1000)"},
{LineNumber: 10, ErrorString: " should use time.Until instead of t.Sub(time.Now()) (S1024)"}}, {LineNumber: 10, ErrorString: " should use time.Until instead of t.Sub(time.Now()) (S1024)"}},