github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/test/fixedbugs/bug244.go (about)

     1  // run
     2  
     3  // Copyright 2010 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  var nf int
    10  var ng int
    11  
    12  func f() (int, int, int) {
    13  	nf++
    14  	return 1, 2, 3
    15  }
    16  
    17  func g() int {
    18  	ng++
    19  	return 4
    20  }
    21  
    22  var x, y, z = f()
    23  var m = make(map[int]int)
    24  var v, ok = m[g()]
    25  
    26  func main() {
    27  	if x != 1 || y != 2 || z != 3 || nf != 1 || v != 0 || ok != false || ng != 1 {
    28  		println("x=", x, " y=", y, " z=", z, " nf=", nf, " v=", v, " ok=", ok, " ng=", ng)
    29  		panic("fail")
    30  	}
    31  }