github.com/AndrienkoAleksandr/go@v0.0.19/src/go/printer/testdata/comments2.input (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  }
   106  
   107  // Test cases for issue 18782
   108  var _ = [][]int{
   109     /*       a, b, c, d, e */
   110     /* a */ {0, 0, 0, 0, 0},
   111     /* b */ {0, 5, 4, 4, 4},
   112     /* c */ {0, 4, 5, 4, 4},
   113     /* d */ {0, 4, 4, 5, 4},
   114     /* e */ {0, 4, 4, 4, 5},
   115  }
   116  
   117  var _ = T{ /* a */ 0,
   118  }
   119  
   120  var _ = T{ /* a */ /* b */ 0,
   121  }
   122  
   123  var _ = T{ /* a */ /* b */
   124     /* c */ 0,
   125  }
   126  
   127  var _ = T{ /* a */ /* b */
   128     /* c */
   129     /* d */ 0,
   130  }
   131  
   132  var _ = T{
   133     /* a */
   134     /* b */ 0,
   135  }
   136  
   137  var _ = T{ /* a */ {},
   138  }
   139  
   140  var _ = T{ /* a */ /* b */ {},
   141  }
   142  
   143  var _ = T{ /* a */ /* b */
   144     /* c */ {},
   145  }
   146  
   147  var _ = T{ /* a */ /* b */
   148     /* c */
   149     /* d */ {},
   150  }
   151  
   152  var _ = T{
   153     /* a */
   154     /* b */ {},
   155  }
   156  
   157  var _ = []T{
   158     func() {
   159        var _ = [][]int{
   160           /*       a, b, c, d, e */
   161           /* a */ {0, 0, 0, 0, 0},
   162           /* b */ {0, 5, 4, 4, 4},
   163           /* c */ {0, 4, 5, 4, 4},
   164           /* d */ {0, 4, 4, 5, 4},
   165           /* e */ {0, 4, 4, 4, 5},
   166        }
   167     },
   168  }