Skip to content

Commit

Permalink
Fix typo in .ignore file and rectify ignore rule logic in tests
Browse files Browse the repository at this point in the history
This commit addresses the issue where the test logic wrongfully inverted the ignore rule condition:

1. A file naming typo (`003.ignroe` corrected to `003.ignore`) has been fixed, ensuring `.ignore` files are now properly recognized. Previously, the misnamed file caused certain test cases to be compared against expected outputs when they should have been ignored.

2. The test logic within `formatter_test.go` that determined whether to ignore discrepancies based on `.ignore` file presence was inverted. Before the fix, the presence of an `.ignore` file led to a test error upon output mismatch, while its absence merely logged the difference without failing the test. The corrected logic now reflects the intended behavior: when an `.ignore` file is present, the differing outputs are logged for review rather than causing the test to fail.
  • Loading branch information
phelrine committed Jan 20, 2024
1 parent 7bc8eb6 commit 462d74a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/formatter/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 462d74a

Please sign in to comment.