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.
Replaced direct bytes.Buffer{} initialization with bytes.NewBuffer(nil) for better consistency and potential performance improvements. This refactor affects both the HTML and plain text alternative writers.
Include various scenarios like default, with existing body string, nil template, and invalid template. These tests help in validating the addition of alternative text templates to messages.
Corrected the expected number of parts in an existing test from 1 to 2. Additionally, introduced tests for adding HTML templates to message bodies, including cases with a valid template, a body string, a nil template, and an invalid template.
Introduced tests for AddAlternativeString and AddAlternativeWriter methods, including variations for charset, encoding, content description, and simultaneous usages. Ensure accurate handling of content types, encodings, and body strings. This enhances coverage and reliability of message formatting features.
Implemented thorough unit tests to validate the SetBodyTextTemplate method in msg_test.go. These tests cover default behavior, handling of nil templates, and invalid templates, ensuring robustness and reliability.
Replace `bytes.Buffer{}` with `bytes.NewBuffer(nil)` for buffer instantiation to improve clarity and consistency. This change simplifies the buffer creation process and aligns it with common Go practices.
Introduced new tests to validate the functionality of `SetBodyWriter` with `WithPartEncoding` and `WithPartContentDescription`. Also added comprehensive tests for `SetBodyHTMLTemplate`, covering default behavior and error cases.
Change buffer initialization from an empty `bytes.Buffer` to `bytes.NewBuffer(nil)` to streamline buffer allocation. This adjustment ensures better flexibility and aligns with best practices in handling buffer slices.
Removed redundant and commented-out test functions to improve code readability and maintainability. Moved the essential helper functions (checkAddrHeader and checkGenHeader) to the end to keep the structure organized.
Updated the skip message to accurately reflect the timeout reason when closing the test server connection. This improves the clarity of the error reporting in tests.
Added a check in the client cleanup function to skip the test if the client connection fails due to a timeout. This ensures that network-related timeouts do not cause test failures, providing more reliable test outcomes.
Added GoLand directive to suppress deprecation warnings for SetAttachements method in msg_test.go. This method is already fully tested by SetAttachments and the test is marked to be skipped.
Introduced new test cases for ContentType values to ensure proper handling. Additionally, simplified multiple error messages in existing tests to enhance readability and maintain consistency.
Introduce tests for `SetEmbeds` with single, multiple, and no files. Add `UnsetAllEmbeds` and `UnsetAllParts` tests to ensure embeds and attachments are removed correctly.
Introduced tests for embedding files and managing attachments in messages. Validated behavior for setting and unsetting attachments and retrieving embedded files with various scenarios.
Implemented comprehensive tests for SetAttachments including scenarios with single, multiple, and no files. Additionally, deprecated the SetAttachements function and noted it as fully tested by SetAttachments.
Eliminated the TestMsg_SetAttachments function from the test suite as it duplicates functionality covered by other tests. Removing this redundant code improves maintainability and clarity.
Introduced a new test case to check `GetAttachments` when no attachments are present in the message object. Removed the redundant `TestMsg_GetAttachments` function to simplify the test suite.
This commit introduces unit tests for the GetAttachments method in the Msg struct to ensure it correctly handles both single and multiple attachments. The tests verify the name and content of the attachments to validate the expected behavior.
Introduce comprehensive tests for the GetGenHeader and GetParts methods. These tests cover single and multiple values for headers, body parts retrieval, and edge cases such as nil values, ensuring robustness and correctness.
Introduced unit tests for GetFrom, GetFromString, GetTo, GetToString, GetCc, GetCcString, GetBcc, and GetBccString methods. These tests cover scenarios with single, multiple, and no addresses, ensuring correct functionality of email address retrieval methods.
Add unit tests for the GetAddrHeaderString function to verify correct behavior for various header types and address counts. These tests ensure the function correctly handles single and multiple addresses, as well as scenarios with no addresses.
Introduce a new test to validate the behavior of GetAddrHeader for handling multiple addresses (to, cc, bcc). This test ensures that the function correctly processes and returns the expected addresses in various headers.
Introduce unit tests for the GetAddrHeader function in the Msg struct. These tests cover various scenarios, including valid addresses and handling of headers like "from," "to," "cc," and "bcc."
Implemented comprehensive tests for the Msg.GetRecipients method, covering various scenarios such as recipients in "to", "cc", "bcc" fields and combinations of these. Ensured correct handling of each case and validation against expected recipient counts and specific addresses.
Ensured the file ends with a newline to comply with best practices. This change improves code readability and consistency with other files in the repository.
Implemented tests for `RequestMDNToFormat`, `RequestMDNAddTo`, and `RequestMDNAddToFormat` methods to ensure proper address handling. Added comprehensive `GetSender` method tests to verify sender retrieval in various scenarios. This enhances coverage and robustness of email message handling functionality.
Simplify the address handling for the "Disposition-Notification-To" header in msg.go. The code now directly reassigns the previously fetched addresses and ensures appending the new address effectively. This improves code readability and correctness in updating the header.
Add checks to initialize `genHeader` if it is nil in the RequestMDNTo method to prevent potential nil map assignment errors. The newly implemented tests showed that this method was never actually working and the old test was inefficient to identify this.
Introduce tests for SetImportance, SetOrganization, SetUserAgent, and IsDelivered methods in the Msg type. These additions ensure the correct behavior and robustness of the email handling functionality.
Added a conditional check to ensure 'NewMsg()' does not return nil in the 'testMessage' helper function. This update will prevent potential nil pointer dereferences and improve the robustness of the test.
Relocated the `isDelivered` flag update to occur after the writer's close method validation. This ensures that the message delivery status is only marked as true if no errors arise during the writer close process. This showed up in the new test cases that covered errors on closing the DATA channel. This can already happen before the first byte is sent to the server. Therefore isDelivered should be set after a successful close.
Reformatted the test cases for European umlaut characters for consistency and readability. This change does not affect the execution or output of the tests.
Introduce tests for SetMessageIDWithValue, SetDate, and SetDateWithValue functions. Enhance coverage and validation for these methods by comparing generated headers and parsed dates.
Replaces direct time formatting in SetDate with a call to SetDateWithValue, improving code reusability and readability. The new approach centralizes date formatting logic in one method.
Introduce unit tests to ensure SetMessageID generates unique IDs and GetMessageID correctly formats various input IDs. Additionally, verify GetMessageID returns an empty string when no ID is set.
Added a test case for European umlaut characters in msg_test.go. Removed redundant test cases related to address handlers (To, Cc, Bcc) and other helper methods to streamline the code.