Skip to content

Commit 2030e6a

Browse files
committed
fix tests
1 parent e062e30 commit 2030e6a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

modules/charset/escape_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package charset
55

66
import (
7+
"regexp"
78
"strings"
89
"testing"
910

@@ -156,13 +157,16 @@ func TestEscapeControlReader(t *testing.T) {
156157
tests = append(tests, test)
157158
}
158159

160+
re := regexp.MustCompile(`repo.ambiguous_character:\d+,\d+`) // simplify the output for the tests, remove the translation variants
159161
for _, tt := range tests {
160162
t.Run(tt.name, func(t *testing.T) {
161163
output := &strings.Builder{}
162164
status, err := EscapeControlReader(strings.NewReader(tt.text), output, &translation.MockLocale{})
163165
assert.NoError(t, err)
164166
assert.Equal(t, tt.status, *status)
165-
assert.Equal(t, tt.result, output.String())
167+
outStr := output.String()
168+
outStr = re.ReplaceAllString(outStr, "repo.ambiguous_character")
169+
assert.Equal(t, tt.result, outStr)
166170
})
167171
}
168172
}

modules/csv/csv_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,14 @@ func TestFormatError(t *testing.T) {
561561
err: &csv.ParseError{
562562
Err: csv.ErrFieldCount,
563563
},
564-
expectedMessage: "repo.error.csv.invalid_field_count",
564+
expectedMessage: "repo.error.csv.invalid_field_count:0",
565565
expectsError: false,
566566
},
567567
{
568568
err: &csv.ParseError{
569569
Err: csv.ErrBareQuote,
570570
},
571-
expectedMessage: "repo.error.csv.unexpected",
571+
expectedMessage: "repo.error.csv.unexpected:0,0",
572572
expectsError: false,
573573
},
574574
{

routers/web/repo/wiki_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func TestNewWikiPost_ReservedName(t *testing.T) {
145145
})
146146
NewWikiPost(ctx)
147147
assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
148-
assert.EqualValues(t, ctx.Tr("repo.wiki.reserved_page"), ctx.Flash.ErrorMsg)
148+
assert.EqualValues(t, ctx.Tr("repo.wiki.reserved_page", "_edit"), ctx.Flash.ErrorMsg)
149149
assertWikiNotExists(t, ctx.Repo.Repository, "_edit")
150150
}
151151

0 commit comments

Comments
 (0)