utf.RuneReader & utf8.RuneScanner

master
Charles Iliya Krempeaux 2022-07-18 21:04:30 -07:00
parent 1c5ab89cc7
commit 35ae548cd2
6 changed files with 13 additions and 13 deletions

View File

@ -37,7 +37,7 @@ var reader io.Reader
// ...
runeReader := utf8.NewRuneReader(reader)
runeReader := utf8.RuneReaderWrap(reader)
// ...
@ -49,7 +49,7 @@ var reader io.Reader
// ...
runeScanner := utf8.NewRuneScanner(reader)
runeScanner := utf8.RuneScannerWrap(reader)
// ...

4
doc.go
View File

@ -30,7 +30,7 @@ Example
// ...
runeReader := utf8.NewRuneReader(reader)
runeReader := utf8.RuneReaderWrap(reader)
// ..
@ -43,7 +43,7 @@ Example
// ...
runeScanner := utf8.NewRuneScanner(reader)
runeScanner := utf8.RuneScannerWrap(reader)
// ...

View File

@ -9,8 +9,8 @@ type RuneReader struct {
reader io.Reader
}
func NewRuneReader(reader io.Reader) *RuneReader {
return &RuneReader{
func RuneReaderWrap(reader io.Reader) RuneReader {
return RuneReader{
reader: reader,
}
}

View File

@ -295,7 +295,7 @@ func TestRuneReader(t *testing.T) {
for testNumber, test := range tests {
runeReader := NewRuneReader(test.Reader)
runeReader := RuneReaderWrap(test.Reader)
actualRune, actualInt, err := runeReader.ReadRune()
if nil != err {
@ -563,7 +563,7 @@ func TestRuneReaders(t *testing.T) {
var runeNumber int
for {
runeReader := NewRuneReader(test.Reader)
runeReader := RuneReaderWrap(test.Reader)
actualRune, actualInt, err := runeReader.ReadRune()
if nil != err && io.EOF != err {

View File

@ -15,8 +15,8 @@ type RuneScanner struct {
peeked bool
}
func NewRuneScanner(reader io.Reader) *RuneScanner {
return &RuneScanner{
func RuneScannerWrap(reader io.Reader) RuneScanner {
return RuneScanner{
reader: reader,
}
}

View File

@ -295,7 +295,7 @@ func TestRuneScanner(t *testing.T) {
for testNumber, test := range tests {
runeReader := NewRuneScanner(test.Reader)
runeReader := RuneScannerWrap(test.Reader)
actualRune, actualInt, err := runeReader.ReadRune()
if nil != err {
@ -563,7 +563,7 @@ func TestRuneScanners(t *testing.T) {
var runeNumber int
for {
runeReader := NewRuneScanner(test.Reader)
runeReader := RuneScannerWrap(test.Reader)
actualRune, actualInt, err := runeReader.ReadRune()
if nil != err && io.EOF != err {
@ -616,7 +616,7 @@ func TestRuneScannerUnread(t *testing.T) {
TestLoop: for testNumber, test := range tests {
runeScanner := NewRuneScanner(test.Reader)
runeScanner := RuneScannerWrap(test.Reader)
var readCount int
for instructionNumber, instruction := range test.Instructions {