mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
move testfiles into testdata dir
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
0
check/testfiles/Godeps/a.go → check/testdata/testfiles/Godeps/a.go
generated
vendored
0
check/testfiles/Godeps/a.go → check/testdata/testfiles/Godeps/a.go
generated
vendored
0
check/testfiles/Godeps/b.go → check/testdata/testfiles/Godeps/b.go
generated
vendored
0
check/testfiles/Godeps/b.go → check/testdata/testfiles/Godeps/b.go
generated
vendored
0
check/testfiles/Godeps/c.go → check/testdata/testfiles/Godeps/c.go
generated
vendored
0
check/testfiles/Godeps/c.go → check/testdata/testfiles/Godeps/c.go
generated
vendored
@@ -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)"}},
|
||||||
|
|||||||
Reference in New Issue
Block a user