Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef13dde

Browse files
committed
normalize line endings
1 parentbe09414 commitef13dde

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎coderd/notifications/notifications_test.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,7 @@ func TestNotificationTemplates_Golden(t *testing.T) {
13291329

13301330
wantBody,err:=os.ReadFile(goldenFile)
13311331
require.NoError(t,err,fmt.Sprintf("missing golden notification body file. %s",hint))
1332+
wantBody=normalizeLineEndings(wantBody)
13321333
require.Equal(t,wantBody,content,fmt.Sprintf("smtp notification does not match golden file. If this is expected, %s",hint))
13331334
})
13341335
})
@@ -1339,7 +1340,11 @@ func TestNotificationTemplates_Golden(t *testing.T) {
13391340
// Required for Windows compatibility.
13401341
funcnormalizeLineEndings(content []byte) []byte {
13411342
content=bytes.ReplaceAll(content, []byte("\r\n"), []byte("\n"))
1342-
returnbytes.ReplaceAll(content, []byte("\r"), []byte("\n"))
1343+
content=bytes.ReplaceAll(content, []byte("\r"), []byte("\n"))
1344+
// some tests generate escaped line endings, so we have to replace them too
1345+
content=bytes.ReplaceAll(content, []byte("\\r\\n"), []byte("\\n"))
1346+
content=bytes.ReplaceAll(content, []byte("\\r"), []byte("\\n"))
1347+
returncontent
13431348
}
13441349

13451350
funcnormalizeGoldenEmail(content []byte) []byte {
@@ -1362,7 +1367,6 @@ func normalizeGoldenEmail(content []byte) []byte {
13621367
content=dateRegex.ReplaceAll(content, []byte("Date: "+constantDate))
13631368
content=messageIDRegex.ReplaceAll(content, []byte("Message-Id: "+constantMessageID))
13641369
content=bytes.ReplaceAll(content,boundary, []byte(constantBoundary))
1365-
content=normalizeLineEndings(content)
13661370

13671371
returncontent
13681372
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp