-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
bugSomething isn't working as expectedSomething isn't working as expectedrefactoringIssues or PRs to improving code structure, without changing its external behaviorIssues or PRs to improving code structure, without changing its external behaviortestingIssues or PRs specifically related to Go testing frameworks or practices.Issues or PRs specifically related to Go testing frameworks or practices.
Description
During a code review of Pull Request #29, it was discovered that when ParseContent is used to copy content from an empty file, the output contains an unexpected newline character (\n) instead of an empty string. This behavior was observed in the following scenario:
- The
readersslice passed toParseContentcontains aFileContentReaderwhere theFilePathpoints to an empty file. - The function returns a string containing only a newline character (
"\n") instead of an empty string ("").
Expected Behavior:
When copying content from an empty file, ParseContent should return an empty string to accurately reflect the lack of content in the file.
Proposed Fix:
Add a check within the loop in ParseContent to ensure that the content read from each reader is not empty before appending a newline character and writing it to the strings.Builder.
Additional Notes:
- Review the unit tests for
ParseContentto ensure they cover the case of empty file input. - Consider adding a test specifically for this scenario to prevent regressions in the future.
Originally posted by @ccoVeille in #29 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't working as expectedSomething isn't working as expectedrefactoringIssues or PRs to improving code structure, without changing its external behaviorIssues or PRs to improving code structure, without changing its external behaviortestingIssues or PRs specifically related to Go testing frameworks or practices.Issues or PRs specifically related to Go testing frameworks or practices.