test: enhance parseContent tests with large file handling and more#19
Merged
test: enhance parseContent tests with large file handling and more#19
Conversation
ccoVeille
suggested changes
Jun 25, 2024
Contributor
|
I would have made distinct commits, at least one for the install.sh |
…etter documentation - Added detailed comments to each unit test function in main_test.go to explain the purpose and steps of the tests. - Improved documentation to make it easier for future developers to understand the intent and functionality of the tests. - TestParseContent_MultipleFiles: Verifies parseContent correctly concatenates contents of multiple files. - TestParseContent_EmptyFiles: Verifies parseContent handles empty files gracefully. - TestParseContent_EmptyInput: Ensures parseContent handles empty input gracefully. - TestParseContent_InvalidFilePath: Checks how parseContent behaves with an invalid file path. - TestParseContent_LargeFile: Verifies parseContent handles large files correctly. - TestParseContent_DirectText: Verifies parseContent handles direct text input correctly. - TestParseContent_Stdin: Verifies parseContent handles stdin input correctly. - TestParseContent_File: Verifies parseContent handles file input correctly. - Added utility functions createTempFile and replaceStdin with detailed comments. Refactor tests to use t.TempDir() for automatic cleanup of temporary files.
Helps handling tests where the creation of random or large data is neeeded.
Owner
Author
I didn't work on the install.sh, it was a mistake to be included in this commit |
This marks replaceStdin as a helper, so when it fails, the error message will indicate the line in the test function that called it, rather than inside the helper itself. This makes debugging easier. Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
This also marks createTempFile as a helper, so when it fails, the error message will indicate the line in the test function that called it, rather than inside the helper itself. This makes debugging easier. Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
Make it clearer what is the use of the nil when testing parseContent
ccoVeille
reviewed
Jun 25, 2024
This was referenced Jun 25, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes aim to improve test coverage and robustness of the parseContent function across various scenarios.
Reviewed in #17
Related to #16 and #15