Home | History | Annotate | Download | only in fixedbugs
      1 // run
      2 
      3 // Copyright 2009 The Go Authors. All rights reserved.
      4 // Use of this source code is governed by a BSD-style
      5 // license that can be found in the LICENSE file.
      6 
      7 package main
      8 
      9 import "fmt"
     10 
     11 func main() {
     12 	var i, k int
     13 	var r string
     14 outer:
     15 	for k = 0; k < 2; k++ {
     16 		r += fmt.Sprintln("outer loop top k", k)
     17 		if k != 0 {
     18 			panic("k not zero")
     19 		} // inner loop breaks this one every time
     20 		for i = 0; i < 2; i++ {
     21 			if i != 0 {
     22 				panic("i not zero")
     23 			} // loop breaks every time
     24 			r += fmt.Sprintln("inner loop top i", i)
     25 			if true {
     26 				r += "do break\n"
     27 				break outer
     28 			}
     29 		}
     30 	}
     31 	r += "broke\n"
     32 	expect := `outer loop top k 0
     33 inner loop top i 0
     34 do break
     35 broke
     36 `
     37 	if r != expect {
     38 		panic(r)
     39 	}
     40 }
     41