Skip to content

test: enhance parseContent tests with large file handling and more#19

Merged
supitsdu merged 5 commits intomainfrom
feature/tests
Jun 25, 2024
Merged

test: enhance parseContent tests with large file handling and more#19
supitsdu merged 5 commits intomainfrom
feature/tests

Conversation

@supitsdu
Copy link
Copy Markdown
Owner

  • Added TestParseContent_LargeFile to ensure parseContent handles large file inputs effectively.
  • Enhanced error checking in TestParseContent_InvalidFilePath to verify specific error conditions like file not found errors.
  • Improved test naming and documentation for clarity and consistency.

These changes aim to improve test coverage and robustness of the parseContent function across various scenarios.

Reviewed in #17
Related to #16 and #15

@supitsdu supitsdu added testing Issues or PRs specifically related to Go testing frameworks or practices. refactoring Issues or PRs to improving code structure, without changing its external behavior under review Issues or PRs currently under evaluation and discussion. labels Jun 25, 2024
@ccoVeille
Copy link
Copy Markdown
Contributor

I would have made distinct commits, at least one for the install.sh

supitsdu added 2 commits June 25, 2024 04:34
…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.
@supitsdu
Copy link
Copy Markdown
Owner Author

I would have made distinct commits, at least one for the install.sh

I didn't work on the install.sh, it was a mistake to be included in this commit

supitsdu and others added 3 commits June 25, 2024 13:00
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
@supitsdu supitsdu self-assigned this Jun 25, 2024
@supitsdu supitsdu merged commit e4a433a into main Jun 25, 2024
@supitsdu supitsdu deleted the feature/tests branch June 25, 2024 16:31
@supitsdu supitsdu removed the under review Issues or PRs currently under evaluation and discussion. label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Issues or PRs to improving code structure, without changing its external behavior testing Issues or PRs specifically related to Go testing frameworks or practices.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants