Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for loopAtEOFSplit (0.11 sec)

  1. src/bufio/scan_test.go

    	testEmptyTokens(t, "1,2,3", []string{"1", "2", "3"})
    }
    
    func loopAtEOFSplit(data []byte, atEOF bool) (advance int, token []byte, err error) {
    	if len(data) > 0 {
    		return 1, data[:1], nil
    	}
    	return 0, data, nil
    }
    
    func TestDontLoopForever(t *testing.T) {
    	s := NewScanner(strings.NewReader("abc"))
    	s.Split(loopAtEOFSplit)
    	// Expect a panic
    	defer func() {
    		err := recover()
    		if err == nil {
    Registered: Tue Oct 29 11:13:09 UTC 2024
    - Last Modified: Fri Sep 22 16:22:42 UTC 2023
    - 14.3K bytes
    - Viewed (0)
Back to top