Skip to content

Commit

Permalink
Remove string(n) (#1117)
Browse files Browse the repository at this point in the history
Automatically submitted.
  • Loading branch information
miekg authored May 14, 2020
1 parent b28dcc1 commit b7da9d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,19 @@ func TestUnpackDomainName(t *testing.T) {
".",
""},
{"long label",
string(63) + maxPrintableLabel + "\x00",
"?" + maxPrintableLabel + "\x00",
maxPrintableLabel + ".",
""},
{"unprintable label",
string(63) + regexp.MustCompile(`\\[0-9]+`).ReplaceAllStringFunc(maxUnprintableLabel,
"?" + regexp.MustCompile(`\\[0-9]+`).ReplaceAllStringFunc(maxUnprintableLabel,
func(escape string) string {
n, _ := strconv.ParseInt(escape[1:], 10, 8)
return string(n)
return string(rune(n))
}) + "\x00",
maxUnprintableLabel + ".",
""},
{"long domain",
string(53) + strings.Replace(longDomain, ".", string(49), -1) + "\x00",
"5" + strings.Replace(longDomain, ".", "1", -1) + "\x00",
longDomain + ".",
""},
{"compression pointer",
Expand All @@ -154,7 +154,7 @@ func TestUnpackDomainName(t *testing.T) {
"foo.\\003com\\000.example.com.",
""},
{"too long domain",
string(54) + "x" + strings.Replace(longDomain, ".", string(49), -1) + "\x00",
"6" + "x" + strings.Replace(longDomain, ".", "1", -1) + "\x00",
"",
ErrLongDomain.Error()},
{"too long by pointer",
Expand Down

0 comments on commit b7da9d9

Please sign in to comment.