Drop regex for canonicalization (#102)

* Drop regex for canonicalization

* Fix CI
This commit is contained in:
wussler 2020-12-01 18:09:25 +01:00 committed by GitHub
parent 5b1a42c2cd
commit 385e6d21d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 19 deletions

View file

@ -2,11 +2,11 @@ package helper
import (
"regexp"
"strings"
"testing"
"github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/ProtonMail/gopenpgp/v2/internal"
"github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/stretchr/testify/assert"
)
@ -45,11 +45,5 @@ func TestSignClearText(t *testing.T) {
if err != nil {
t.Fatal("Cannot parse message:", err)
}
assert.Exactly(t, canonicalizeAndTrim(inputPlainText), string(clearTextMessage.GetBinary()))
}
func canonicalizeAndTrim(text string) string {
text = internal.TrimWhitespace(text)
text = strings.ReplaceAll(strings.ReplaceAll(text, "\r\n", "\n"), "\n", "\r\n")
return text
assert.Exactly(t, internal.CanonicalizeAndTrim(inputPlainText), string(clearTextMessage.GetBinary()))
}