Use transform.Transformer interface for ascii sanitization (#7117)
This commit is contained in:
parent
661d962112
commit
78ffa73f44
2 changed files with 69 additions and 82 deletions
|
|
@ -86,12 +86,8 @@ func TestHTTPClientSanitizeASCIIControlCharactersC1(t *testing.T) {
|
|||
assert.Equal(t, "monalisa¡", issue.Author.Login)
|
||||
}
|
||||
|
||||
func TestSanitizeASCIIReadCloser(t *testing.T) {
|
||||
data := []byte(`"Assign},"L`)
|
||||
var r io.Reader = bytes.NewReader(data)
|
||||
r = &sanitizeASCIIReadCloser{ReadCloser: io.NopCloser(r)}
|
||||
r = iotest.OneByteReader(r)
|
||||
out, err := io.ReadAll(r)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, data, out)
|
||||
func TestSanitizedReadCloser(t *testing.T) {
|
||||
data := []byte(`the quick brown fox\njumped over the lazy dog\t`)
|
||||
rc := sanitizedReadCloser(io.NopCloser(bytes.NewReader(data)))
|
||||
assert.NoError(t, iotest.TestReader(rc, data))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue