Compare commits

...

4 commits

Author SHA1 Message Date
02308df4fd
Merge pull request #254 from wneessen/dependabot/github_actions/sonarsource/sonarqube-scan-action-2.3.0
Bump sonarsource/sonarqube-scan-action from 2.2.0 to 2.3.0
2024-07-02 15:53:51 +02:00
dependabot[bot]
09521758db
Bump sonarsource/sonarqube-scan-action from 2.2.0 to 2.3.0
Bumps [sonarsource/sonarqube-scan-action](https://github.com/sonarsource/sonarqube-scan-action) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/sonarsource/sonarqube-scan-action/releases)
- [Commits](540792c588...aecaf43ae5)

---
updated-dependencies:
- dependency-name: sonarsource/sonarqube-scan-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-02 13:51:17 +00:00
32a5603496
Merge pull request #253 from wneessen/feature/add_get_boundary
Add GetBoundary method and corresponding test
2024-07-02 11:11:33 +02:00
b88b67e2c7
Add GetBoundary method and corresponding test
The GetBoundary method has been added to the Msg struct in msg.go. Alongside this, a corresponding test method, TestMsg_GetBoundary, was introduced in msg_test.go to ensure the proper working of GetBoundary. This new method returns the boundary string of the Msg, which was previously inaccessible.
2024-07-02 10:58:13 +02:00
3 changed files with 19 additions and 1 deletions

View file

@ -44,7 +44,7 @@ jobs:
run: |
go test -v -race --coverprofile=./cov.out ./...
- uses: sonarsource/sonarqube-scan-action@540792c588b5c2740ad2bb4667db5cd46ae678f2 # master
- uses: sonarsource/sonarqube-scan-action@aecaf43ae57e412bd97d70ef9ce6076e672fe0a9 # master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

5
msg.go
View file

@ -679,6 +679,11 @@ func (m *Msg) GetAttachments() []*File {
return m.attachments
}
// GetBoundary returns the boundary of the Msg
func (m *Msg) GetBoundary() string {
return m.boundary
}
// SetAttachements sets the attachements of the message.
func (m *Msg) SetAttachements(files []*File) {
m.attachments = files

View file

@ -2855,6 +2855,19 @@ func TestMsg_GetBccString(t *testing.T) {
}
}
// TestMsg_GetBoundary will test the Msg.GetBoundary method
func TestMsg_GetBoundary(t *testing.T) {
b := "random_boundary_string"
m := NewMsg()
if boundary := m.GetBoundary(); boundary != "" {
t.Errorf("GetBoundary failed. Expected empty string, but got: %s", boundary)
}
m = NewMsg(WithBoundary(b))
if boundary := m.GetBoundary(); boundary != b {
t.Errorf("GetBoundary failed. Expected boundary: %s, got: %s", b, boundary)
}
}
// TestMsg_AttachEmbedReader_consecutive tests the Msg.AttachReader and Msg.EmbedReader
// methods with consecutive calls to Msg.WriteTo to make sure the attachments are not
// lost (see Github issue #110)