github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/cmd/go/testdata/example2_test.go (about)

     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  // Make sure that go test runs Example_Y before Example_B, preserving source order.
     6  
     7  package p
     8  
     9  import "fmt"
    10  
    11  func Example_Y() {
    12  	n++
    13  	fmt.Println(n)
    14  	// Output: 3
    15  }
    16  
    17  func Example_B() {
    18  	n++
    19  	fmt.Println(n)
    20  	// Output: 4
    21  }