Updated the base64-encoded string for attachments in the tests to reflect the correct newline character for Windows. This ensures that the test cases correctly validate the presence of attachments in the mail messages.
Added platform-specific checks for header and attachment content in `msgwriter_test.go`. This ensures compatibility and correct behavior on different operating systems, such as Windows and FreeBSD.
Introduced a new test attachment file for testing purposes. Also added a corresponding license file indicating copyright and licensing information for transparency and compliance.
Introduce comprehensive test cases for the writeHeader and writeBody functions in msgWriter. These tests cover various scenarios including handling of multiple header values, edge cases, and error conditions in body writing operations. This concludes all tests for msgwriter.go.
Implemented tests to validate the MsgWriter writeString method for successful writes, failure scenarios, and handling pre-existing errors in the writer. This improves coverage and ensures robustness of the MsgWriter component.
Introduce tests to validate MsgWriter's handling of message parts. This includes ensuring charset defaulting behavior and proper inclusion of part descriptions.
The TestRcpt constant was defined but never used within the test file, leading to unnecessary clutter. Removing it enhances code readability and maintainability.
This commit introduces unit tests covering various scenarios for attaching files in email messages using msgWriter. These tests check for proper encoding, custom content types, different transfer encodings, custom descriptions, and handling attachments without body parts.
Reorganize existing tests for msgWriter and writeMsg, adding subtests for various encoding, charset, and failure scenarios. Enhanced tests to cover multipart/mixed, multipart/related, multipart/alternative, application/pgp-encrypted, application/pgp-signature messages, and handling of preformatted headers.
Added tests for `AttachReader`, `AttachReadSeeker`, `EmbedReader`, and `EmbedReadSeeker` methods with consecutive `WriteTo` calls to ensure attachments are not lost. This addresses issue #110 on GitHub. Also, added tests for `SetBodyWriter` with a nil option and improved existing tests for `hasAlt` and `hasMixed` methods. This commit concludes the tests for msg.go. We have achieved the highest possible coverage.
Implemented unit tests for WriteToTempFile, including successful writing to a temporary file and failure cases due to an invalid TMPDIR. These tests ensure the method behaves correctly under different conditions and enhances code robustness.
Added a check for the "PERFORM_UNIX_OPEN_WRITE_TESTS" environment variable to conditionally skip tests. This ensures tests are only executed when the variable is set to "true". Additionally, commented out the TestMsg_WriteToTempFileFailed function.
Introduce several unit tests for the Msg.HasSendError function to ensure its correct behavior under different conditions like unsent messages, failed deliveries, and temporary errors. This enhances the validation of message error states within the system.
Introduce a new `FailTemp` property to simulate a temporary failure during the DATA transmission phase in tests. This helps ensure better coverage and handling of specific error conditions.
Implemented new tests to validate the Msg.UpdateReader method, ensuring its functionality for both success and failure scenarios. Removed obsolete tests for Msg.NewReader to maintain code clarity and relevance.
Reorganized message writing tests to create more concise and specific scenarios, including new context tests and WriteToFile tests. Removed outdated and redundant test cases to streamline the test suite.
Replaced bytes.Buffer{} with bytes.NewBuffer(nil) for buffer initialization in NewReader method of Msg. This change enhances clarity and consistency in buffer handling.
Standardize variables by using expressions for consistency. This change ensures that all environment variables for Unix and Sendmail tests are sourced from GitHub variables.
A newline was added after an anonymous function block to improve code readability. This change adheres to proper formatting practices and enhances the maintainability of the code.
Unified the test cases for AttachFile, AttachReader, AttachReadSeeker, EmbedFile, EmbedReader, and EmbedReadSeeker by incorporating the previously separate UNIX-specific tests into the general test files. This change enhances maintainability by reducing code duplication and ensuring more consistent test coverage across platforms.
Implemented tests for the Msg.Write method and enhanced WriteTo error handling. Also added a failReadWriteSeekCloser type to explicitly simulate IO failures in tests, ensuring comprehensive reliability of error handling mechanisms.
Implement a new test for the WriteToSkipMiddleware function to validate its behavior with normal mail parts. Ensure that the function properly skips the specified middleware and writes the message to a buffer correctly.
Introduced comprehensive test cases for applying middlewares (uppercase and encode) to messages. Also added tests for writing messages to memory buffers and parsing them back. Corrected messages in helper functions for consistency.
This test ensures that the Reset method correctly clears all fields in the Msg struct. It verifies that the From, To, Subject, Body, Attachments, and Embeds fields are empty after calling Reset.
Eliminated multiple test functions for file attachments and embeds, including TestMsg_AttachFile, TestMsg_AttachFromEmbedFS, and TestMsg_EmbedFile. These tests either duplicated functionality or were no longer relevant to the current code base. Simplifying the test suite enhances maintainability and reduces unnecessary checks.
Introduce unit tests for EmbedReadSeeker, EmbedHTMLTemplate, EmbedTextTemplate, and EmbedFromEmbedFS methods in the Msg package. These tests cover various use cases and error scenarios, ensuring the correct handling of embedded content.
Introduced unit tests to verify the embedding of files and readers in messages, including tests specific to Unix file handling scenarios. These tests ensure correct handling of embed errors and proper cleanup of temporary files.
This commit introduces three new test cases to validate the EmbedFile function in the msg_test.go file. The tests cover embedding an existing file, handling a non-existent file, and referencing pre-tested options.
Introduce two new test cases for the AttachFromEmbedFS method. These tests verify that the method correctly handles an invalid file path and a nil embed FS, ensuring error scenarios are properly managed.
Included unit tests to verify the functionality of the AttachHTMLTemplate and AttachTextTemplate methods, ensuring valid, invalid, and nil templates are handled correctly. Also added tests for AttachFromEmbedFS to validate attachments from embedded files.
Updated project and patch coverage targets to 90% from 85% and 80%, respectively. Tightened thresholds from 5% to 2% to enforce stricter quality controls.
Introduce tests for the AttachReadSeeker method, detailing scenarios for general use and Unix-specific paths. Ensure file handling and error conditions are properly validated to maintain robustness.
This commit eliminates the duplication of the '14.1' OS version in the CI workflow matrix configuration. Simplifying the matrix helps in avoiding redundant test runs and ensures a clearer CI process.
Added a test environment variable to control Unix write tests and included their setup in the test function. Also corrected the OS version matrix by uncommenting '14.0' and '13.4'.
Renamed `msg_nowin_test.go` to `msg_unix_test.go` to better reflect its purpose. Updated the file attachment test to use `/dev/mem` for Unix environments instead of a temporary file with restricted permissions, ensuring compatibility with continuous integration environments.
The .cirrus.yml file was removed as it is no longer needed for our CI/CD processes. This helps clean up the repository and avoids confusion over unused configurations.
Changed tempfile creation path to "testdata/tmp" for better test organization and to ensure temporary files are stored within the testdata directory. This change affects the TestMsg_AttachFile_unixOnly tests.
The harden-runner step has been removed from the FreeBSD testing matrix in the CI workflow. This change simplifies the workflow and removes an additional security auditing step.
Eliminated a redundant "Run go test" step from the GitHub Actions CI configuration. This helps streamline the workflow and avoid unnecessary repetitions in the CI process.
Included FreeBSD versions 13.4, 14.0, and 14.1 in the CI pipeline. Configured the workflow to harden the runner, checkout code, and run tests on the FreeBSD virtual machine.
Removed unnecessary assertions for specific error types in test cases. This streamlines the tests, maintaining focus on the primary failure conditions without checking the error type.
Updated the chmod call in msg_nowin_test.go to use the consistent and proper octal literal syntax (0o000) instead of 0000. This change improves code readability and aligns with Go convention.
Removed commented-out tests to clean up the codebase. Added a new test to verify behavior when the file is closed early during attachment, ensuring robustness.
Introduce new unit tests for verifying the `AttachReader` method and enhancing error handling in attachment functions. These tests cover scenarios for success, file permissions, and early file closure errors.
Replace t.Skip with t.Log to avoid skipping tests and ensure they log their status. Introduce a comprehensive test for the AttachFile method, covering cases with existing, non-existent files, and using options.