github.com/gocuntian/go@v0.0.0-20160610041250-fee02d270bf8/src/go/printer/testdata/comments2.golden (about)

     1  // Copyright 2012 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  // This is a package for testing comment placement by go/printer.
     6  //
     7  package main
     8  
     9  // Test cases for idempotent comment formatting (was issue 1835).
    10  /*
    11  c1a
    12  */
    13  /*
    14     c1b
    15  */
    16  /* foo
    17  c1c
    18  */
    19  /* foo
    20     c1d
    21  */
    22  /*
    23  c1e
    24  foo */
    25  /*
    26     c1f
    27     foo */
    28  
    29  func f() {
    30  	/*
    31  	   c2a
    32  	*/
    33  	/*
    34  	   c2b
    35  	*/
    36  	/* foo
    37  	   c2c
    38  	*/
    39  	/* foo
    40  	   c2d
    41  	*/
    42  	/*
    43  	   c2e
    44  	   foo */
    45  	/*
    46  	   c2f
    47  	   foo */
    48  }
    49  
    50  func g() {
    51  	/*
    52  	   c3a
    53  	*/
    54  	/*
    55  	   c3b
    56  	*/
    57  	/* foo
    58  	   c3c
    59  	*/
    60  	/* foo
    61  	   c3d
    62  	*/
    63  	/*
    64  	   c3e
    65  	   foo */
    66  	/*
    67  	   c3f
    68  	   foo */
    69  }
    70  
    71  // Test case taken literally from issue 1835.
    72  func main() {
    73  	/*
    74  	   prints test 5 times
    75  	*/
    76  	for i := 0; i < 5; i++ {
    77  		println("test")
    78  	}
    79  }
    80  
    81  func issue5623() {
    82  L:
    83  	_ = yyyyyyyyyyyyyyyy			// comment - should be aligned
    84  	_ = xxxxxxxxxxxxxxxxxxxxxxxxxxxx	/* comment */
    85  
    86  	_ = yyyyyyyyyyyyyyyy			/* comment - should be aligned */
    87  	_ = xxxxxxxxxxxxxxxxxxxxxxxxxxxx	// comment
    88  
    89  LLLLLLL:
    90  	_ = yyyyyyyyyyyyyyyy			// comment - should be aligned
    91  	_ = xxxxxxxxxxxxxxxxxxxxxxxxxxxx	// comment
    92  
    93  LL:
    94  LLLLL:
    95  	_ = xxxxxxxxxxxxxxxxxxxxxxxxxxxx	/* comment */
    96  	_ = yyyyyyyyyyyyyyyy			/* comment - should be aligned */
    97  
    98  	_ = xxxxxxxxxxxxxxxxxxxxxxxxxxxx	// comment
    99  	_ = yyyyyyyyyyyyyyyy			// comment - should be aligned
   100  
   101  	// test case from issue
   102  label:
   103  	mask := uint64(1)<<c - 1		// Allocation mask
   104  	used := atomic.LoadUint64(&h.used)	// Current allocations
   105  }