From f51fffb7aad49a982b196094df9db0f3f87b7911 Mon Sep 17 00:00:00 2001 From: Trym bremnes Date: Thu, 18 Apr 2024 07:03:22 +0200 Subject: [PATCH] refactor: renamed `testdata` dir There is a convention in `GO` to name the test data directory `testdata`, not `test-data`. This convention comes from the part of `go help packages` that says: ``` Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata". ``` --- .gitattributes | 4 ++-- cmd/convert/nedlib/nedlib_test.go | 2 +- cmd/ls/ls_test.go | 4 ++-- cmd/validate/validate_test.go | 2 +- .../nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 | 0 .../nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5.meta | 0 .../nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 | 0 .../nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5.meta | 0 {test-data => testdata}/samsung-with-error/README.md | 0 .../rec-33318048d933-20240317162652059-0.warc.gz | 0 10 files changed, 6 insertions(+), 6 deletions(-) rename {test-data => testdata}/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 (100%) rename {test-data => testdata}/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5.meta (100%) rename {test-data => testdata}/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 (100%) rename {test-data => testdata}/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5.meta (100%) rename {test-data => testdata}/samsung-with-error/README.md (100%) rename {test-data => testdata}/samsung-with-error/rec-33318048d933-20240317162652059-0.warc.gz (100%) diff --git a/.gitattributes b/.gitattributes index f631dcc4..2575425c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ *.warc.gz filter=lfs diff=lfs merge=lfs -text -test-data/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 filter=lfs diff=lfs merge=lfs -text -test-data/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 filter=lfs diff=lfs merge=lfs -text +testdata/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 filter=lfs diff=lfs merge=lfs -text +testdata/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 filter=lfs diff=lfs merge=lfs -text *.meta filter=lfs diff=lfs merge=lfs -text diff --git a/cmd/convert/nedlib/nedlib_test.go b/cmd/convert/nedlib/nedlib_test.go index be3aff47..4d1f962a 100644 --- a/cmd/convert/nedlib/nedlib_test.go +++ b/cmd/convert/nedlib/nedlib_test.go @@ -16,7 +16,7 @@ func (fileWalker *walker) dummyWalkFunction(_ afero.Fs, path string) filewalker. } func TestConvert(t *testing.T) { - testDataDir := filepath.Join("..", "..", "test-data") + testDataDir := filepath.Join("..", "..", "testdata") nedlibDir := filepath.Join(testDataDir, "nedlib", "nb-image") fileWalker := walker{} diff --git a/cmd/ls/ls_test.go b/cmd/ls/ls_test.go index 18668c2a..2247a6b7 100644 --- a/cmd/ls/ls_test.go +++ b/cmd/ls/ls_test.go @@ -10,7 +10,7 @@ import ( ) func TestConfigReadFileWithError(t *testing.T) { - testDataDir := filepath.Join("..", "..", "test-data") + testDataDir := filepath.Join("..", "..", "testdata") warcWithErrors := filepath.Join(testDataDir, "samsung-with-error", "rec-33318048d933-20240317162652059-0.warc.gz") config := &conf{} config.filter = filter.NewFromViper() @@ -24,7 +24,7 @@ func BenchmarkReadFileWithError(b *testing.B) { // `github-action-benchmark` is unable to handle some of the output in the // benchmark result files. os.Stdout = nil - testDataDir := filepath.Join("..", "..", "test-data") + testDataDir := filepath.Join("..", "..", "testdata") warcWithErrors := filepath.Join(testDataDir, "samsung-with-error", "rec-33318048d933-20240317162652059-0.warc.gz") config := &conf{} config.filter = filter.NewFromViper() diff --git a/cmd/validate/validate_test.go b/cmd/validate/validate_test.go index 7382cbbc..b8b36a06 100644 --- a/cmd/validate/validate_test.go +++ b/cmd/validate/validate_test.go @@ -8,7 +8,7 @@ import ( ) func TestValidateSamsungFileWithError(t *testing.T) { - testDataDir := filepath.Join("..", "..", "test-data") + testDataDir := filepath.Join("..", "..", "testdata") warcWithErrors := filepath.Join(testDataDir, "samsung-with-error", "rec-33318048d933-20240317162652059-0.warc.gz") defer func() { if r := recover(); r == nil { diff --git a/test-data/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 b/testdata/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 similarity index 100% rename from test-data/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 rename to testdata/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5 diff --git a/test-data/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5.meta b/testdata/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5.meta similarity index 100% rename from test-data/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5.meta rename to testdata/nedlib/nb-image/b863a630196bce1a15ca86b40f34a2d5.meta diff --git a/test-data/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 b/testdata/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 similarity index 100% rename from test-data/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 rename to testdata/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5 diff --git a/test-data/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5.meta b/testdata/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5.meta similarity index 100% rename from test-data/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5.meta rename to testdata/nedlib/nb-image/e4a2d28bdf4c38b8f6f291f7c8c958d5.meta diff --git a/test-data/samsung-with-error/README.md b/testdata/samsung-with-error/README.md similarity index 100% rename from test-data/samsung-with-error/README.md rename to testdata/samsung-with-error/README.md diff --git a/test-data/samsung-with-error/rec-33318048d933-20240317162652059-0.warc.gz b/testdata/samsung-with-error/rec-33318048d933-20240317162652059-0.warc.gz similarity index 100% rename from test-data/samsung-with-error/rec-33318048d933-20240317162652059-0.warc.gz rename to testdata/samsung-with-error/rec-33318048d933-20240317162652059-0.warc.gz