Skip to content

Commit

Permalink
fix: allow for newlines in expectedExitCode.txt (#1987)
Browse files Browse the repository at this point in the history
<!-- Thanks for sending a PR! Before submitting:

1. If this is your first PR, please read CONTRIBUTING.md and sign the
CLA
   first. We cannot review code without a signed CLA.
2. Please file an issue *first*. All features and most bug fixes should
have
an associated issue with a design discussed and decided upon. Small bug
   fixes and documentation improvements don't need issues.
3. New features and bug fixes must have tests. Documentation may need to
be updated. If you're unsure what to update, send the PR, and we'll
discuss
   in review.
-->

**What type of PR is this?**

Bug fix

**What package or component does this PR mostly affect?**

testtools

**What does this PR do? Why is it needed?**

Small fix to allow newlines in `expectedExitCode.txt` files which can be
added automatically by formatters.

**Which issues(s) does this PR fix?**

N/A

**Other notes for review**
  • Loading branch information
mclarke47 authored Nov 22, 2024
1 parent 28f43a4 commit 2898dda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion testtools/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func TestGazelleGenerationOnPath(t *testing.T, args *TestGazelleGenerationArgs)
return nil
}
if d.Name() == expectedExitCodeFilename {
config.ExitCode, err = strconv.Atoi(string(content))
config.ExitCode, err = strconv.Atoi(strings.TrimSpace(string(content)))
if err != nil {
// Set the ExitCode to a sentinel value (-1) to ensure that if the caller is updating the files on disk the value is updated.
config.ExitCode = -1
Expand Down

0 comments on commit 2898dda

Please sign in to comment.