test: fix linter package names (#23)

* test: fix linter package names

* chore: pr-lint.yml
This commit is contained in:
2025-07-14 01:48:39 +03:00
committed by GitHub
parent 70fede7635
commit 9a2bbda223
6 changed files with 28 additions and 25 deletions

View File

@@ -1,8 +1,10 @@
package fileproc
package fileproc_test
import (
"os"
"testing"
fileproc "github.com/ivuorinen/gibidify/fileproc"
)
func TestCollectFilesWithFakeWalker(t *testing.T) {
@@ -11,7 +13,7 @@ func TestCollectFilesWithFakeWalker(t *testing.T) {
"/path/to/file1.txt",
"/path/to/file2.go",
}
fake := FakeWalker{
fake := fileproc.FakeWalker{
Files: expectedFiles,
Err: nil,
}
@@ -35,7 +37,7 @@ func TestCollectFilesWithFakeWalker(t *testing.T) {
func TestCollectFilesError(t *testing.T) {
// Fake walker returns an error.
fake := FakeWalker{
fake := fileproc.FakeWalker{
Files: nil,
Err: os.ErrNotExist,
}

View File

@@ -1,10 +1,12 @@
package fileproc
package fileproc_test
import (
"os"
"strings"
"sync"
"testing"
fileproc "github.com/ivuorinen/gibidify/fileproc"
)
func TestProcessFile(t *testing.T) {
@@ -30,12 +32,12 @@ func TestProcessFile(t *testing.T) {
return
}
ch := make(chan WriteRequest, 1)
ch := make(chan fileproc.WriteRequest, 1)
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
ProcessFile(tmpFile.Name(), ch, "")
fileproc.ProcessFile(tmpFile.Name(), ch, "")
}()
wg.Wait()
close(ch)

View File

@@ -1,4 +1,4 @@
package fileproc
package fileproc_test
import (
"os"
@@ -6,6 +6,7 @@ import (
"testing"
"github.com/ivuorinen/gibidify/config"
fileproc "github.com/ivuorinen/gibidify/fileproc"
"github.com/spf13/viper"
)
@@ -53,7 +54,7 @@ func TestProdWalkerWithIgnore(t *testing.T) {
viper.Set("ignoreDirectories", []string{"vendor"})
// Run walker
var w Walker = ProdWalker{}
var w fileproc.Walker = fileproc.ProdWalker{}
found, err := w.Walk(rootDir)
if err != nil {
t.Fatalf("Walk returned error: %v", err)
@@ -96,7 +97,7 @@ func TestProdWalkerBinaryCheck(t *testing.T) {
config.LoadConfig()
// Run walker
var w Walker = ProdWalker{}
var w fileproc.Walker = fileproc.ProdWalker{}
found, err := w.Walk(rootDir)
if err != nil {
t.Fatalf("Walk returned error: %v", err)
@@ -139,7 +140,7 @@ func TestProdWalkerSizeLimit(t *testing.T) {
viper.Reset()
config.LoadConfig()
var w Walker = ProdWalker{}
var w fileproc.Walker = fileproc.ProdWalker{}
found, err := w.Walk(rootDir)
if err != nil {
t.Fatalf("Walk returned error: %v", err)

View File

@@ -1,4 +1,4 @@
package fileproc
package fileproc_test
import (
"encoding/json"
@@ -7,6 +7,7 @@ import (
"sync"
"testing"
fileproc "github.com/ivuorinen/gibidify/fileproc"
"gopkg.in/yaml.v3"
)
@@ -55,12 +56,12 @@ func TestStartWriter_Formats(t *testing.T) {
}()
// Prepare channels
writeCh := make(chan WriteRequest, 2)
writeCh := make(chan fileproc.WriteRequest, 2)
doneCh := make(chan struct{})
// Write a couple of sample requests
writeCh <- WriteRequest{Path: "sample.go", Content: "package main"}
writeCh <- WriteRequest{Path: "example.py", Content: "def foo(): pass"}
writeCh <- fileproc.WriteRequest{Path: "sample.go", Content: "package main"}
writeCh <- fileproc.WriteRequest{Path: "example.py", Content: "def foo(): pass"}
close(writeCh)
// Start the writer
@@ -68,7 +69,7 @@ func TestStartWriter_Formats(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
StartWriter(outFile, writeCh, doneCh, tc.format, "PREFIX", "SUFFIX")
fileproc.StartWriter(outFile, writeCh, doneCh, tc.format, "PREFIX", "SUFFIX")
}()
// Wait until writer signals completion
@@ -94,12 +95,12 @@ func TestStartWriter_Formats(t *testing.T) {
switch tc.format {
case "json":
// Quick parse check
var outStruct OutputData
var outStruct fileproc.OutputData
if err := json.Unmarshal(data, &outStruct); err != nil {
t.Errorf("JSON unmarshal failed: %v", err)
}
case "yaml":
var outStruct OutputData
var outStruct fileproc.OutputData
if err := yaml.Unmarshal(data, &outStruct); err != nil {
t.Errorf("YAML unmarshal failed: %v", err)
}