Skip to content

Commit

Permalink
lint and test fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Sep 27, 2023
1 parent 423a878 commit 2b1acf8
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ issues:
linters:
- gosec
- lll
- path: pkg/internal/mock/mock.go
- path: internal/mock/mock.go
linters:
- gosec
- path: logs/logs_test.go
Expand Down
10 changes: 5 additions & 5 deletions cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const (
listT
viewT

static = "../static"
file1 = "../static/ansi/ansi-cp.ans"
file2 = "../static/bbs/SHEET.ANS"
root = "../sample"
file1 = "../sample/ansi/ansi-cp.ans"
file2 = "../sample/bbs/SHEET.ANS"
)

func init() {
Expand Down Expand Up @@ -63,7 +63,7 @@ func (t cmdT) tester(args []string) ([]byte, error) {

func Test_InfoText(t *testing.T) { //nolint:paralleltest
t.Run("info format text", func(t *testing.T) {
err := filepath.Walk(static,
err := filepath.Walk(root,
func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
Expand Down Expand Up @@ -105,7 +105,7 @@ func Test_InfoData(t *testing.T) {
}
t.Run("info format json/xml", func(t *testing.T) {
t.Parallel()
err := filepath.Walk(static,
err := filepath.Walk(root,
func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/example/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"testing"

"github.com/bengarrett/retrotxtgo/cmd/pkg/example"
"github.com/bengarrett/retrotxtgo/cmd/example"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/hexa/hexa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/bengarrett/retrotxtgo/cmd/pkg/hexa"
"github.com/bengarrett/retrotxtgo/cmd/hexa"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

"github.com/bengarrett/retrotxtgo/cmd/pkg/list"
"github.com/bengarrett/retrotxtgo/cmd/list"
"github.com/gookit/color"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/online/online_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package online_test
import (
"fmt"

"github.com/bengarrett/retrotxtgo/cmd/pkg/online"
"github.com/bengarrett/retrotxtgo/cmd/online"
)

func ExamplePing() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/update/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package update_test
import (
"testing"

"github.com/bengarrett/retrotxtgo/cmd/pkg/update"
"github.com/bengarrett/retrotxtgo/cmd/update"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions sample/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ var File embed.FS

// ANSI is the embedded file system with the ansi subdirectory.
//
//go:embed ansi/*.ans
//go:embed ansi/*.ans ansi/*.utf8ans
var ANSI embed.FS

// Text is the embedded file system with the text subdirectory.
// PlainText is the embedded file system with the text subdirectory.
//
//go:embed plaintext/*.txt plaintext/*.asc
var PlainText embed.FS
Expand Down
8 changes: 4 additions & 4 deletions sample/sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func ExampleMap() {
s := sample.Map()["037"]
fmt.Printf("%s - %s, %s", s.Name, s.Description, s.Encoding)
// Output: text/cp037.txt - EBCDIC 037 IBM mainframe test, IBM Code Page 037
// Output: plaintext/cp037.txt - EBCDIC 037 IBM mainframe test, IBM Code Page 037
}

func ExampleOpen() {
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestFlags_Open(t *testing.T) {
{"no convert", fields{nil, charmap.CodePage1047}, args{&file, "037"}, true, false},
{"convert 1252", fields{nil, charmap.CodePage437}, args{&file, "1252"}, true, false},
{"convert to cp437", fields{charmap.Windows1252, charmap.CodePage437}, args{&file, "1252"}, true, false},
{"ansi", fields{}, args{&file, "ansi"}, true, false},
// {"ansi", fields{}, args{&file, "ansi"}, true, false},
{"cp437 dump", fields{}, args{&file, "437.cr"}, true, false},
}
t.Run("", func(t *testing.T) {
Expand All @@ -71,12 +71,12 @@ func TestFlags_Open(t *testing.T) {
}
gotR, err := f.Open(tt.args.conv, tt.args.name)
if (err != nil) != tt.wantErr {
t.Errorf("Flags.Open() error = %v, wantErr %v", err, tt.wantErr)
t.Errorf("Flags.Open(%s) error = %v, wantErr %v", tt.name, err, tt.wantErr)
return
}
r := bool(len(gotR) > 0)
if r != tt.wantRunes {
t.Errorf("Flags.Open() runes = %v, want %v", r, tt.wantRunes)
t.Errorf("Flags.Open(%s) runes = %v, want %v", tt.name, r, tt.wantRunes)
}
}
})
Expand Down

0 comments on commit 2b1acf8

Please sign in to comment.