...
Run Format

Source file src/bufio/export_test.go

Documentation: bufio

     1  // Copyright 2013 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package bufio
     6  
     7  // Exported for testing only.
     8  import (
     9  	"unicode/utf8"
    10  )
    11  
    12  var IsSpace = isSpace
    13  
    14  const DefaultBufSize = defaultBufSize
    15  
    16  func (s *Scanner) MaxTokenSize(n int) {
    17  	if n < utf8.UTFMax || n > 1e9 {
    18  		panic("bad max token size")
    19  	}
    20  	if n < len(s.buf) {
    21  		s.buf = make([]byte, n)
    22  	}
    23  	s.maxTokenSize = n
    24  }
    25  
    26  // ErrOrEOF is like Err, but returns EOF. Used to test a corner case.
    27  func (s *Scanner) ErrOrEOF() error {
    28  	return s.err
    29  }
    30  

View as plain text