Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestStringIndexHaystack (0.27 sec)

  1. src/runtime/string_test.go

    		}
    		if string(b) >= s {
    		} else {
    			t.Fatalf("strings are not equal: '%v' and '%v'", string(b), s)
    		}
    	})
    	if n != 0 {
    		t.Fatalf("want 0 allocs, got %v", n)
    	}
    }
    
    func TestStringIndexHaystack(t *testing.T) {
    	// See issue 25864.
    	haystack := []byte("hello")
    	needle := "ll"
    	n := testing.AllocsPerRun(1000, func() {
    		if strings.Index(string(haystack), needle) != 2 {
    			t.Fatalf("needle not found")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 13 14:05:23 UTC 2022
    - 13.3K bytes
    - Viewed (0)
Back to top