Skip to content

Commit

Permalink
Merge pull request #132 from phelrine/fix-formatter-test
Browse files Browse the repository at this point in the history
Fix formatter test setup and ignore condition
  • Loading branch information
mattn authored Jan 20, 2024
2 parents 7bc8eb6 + bf00c55 commit d0751d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/formatter/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ func TestFormat(t *testing.T) {
LowerCase: false,
IdentifierQuoted: false,
}
env := &formatEnvironment{}
for _, fname := range files {
b, err := os.ReadFile(fname)
if err != nil {
Expand All @@ -147,6 +146,7 @@ func TestFormat(t *testing.T) {
if err != nil {
t.Fatal(err)
}
env := &formatEnvironment{}
formatted := Eval(parsed, env)
got := strings.TrimRight(formatted.Render(opts), "\n") + "\n"

Expand All @@ -156,7 +156,7 @@ func TestFormat(t *testing.T) {
}
want := string(b)
if got != want {
if _, err := os.Stat(fname[:len(fname)-4] + ".ignore"); err != nil {
if _, err := os.Stat(fname[:len(fname)-4] + ".ignore"); err == nil {
t.Logf("%s:\n"+
" want: %q\n"+
" got: %q\n",
Expand Down
File renamed without changes.

0 comments on commit d0751d8

Please sign in to comment.