cuelang.org/go@v0.10.1/cue/format/testdata/comments.txtar (about)

     1  simplify
     2  
     3  -- comments.input --
     4  // Package line 1 group 1
     5  // Package line 2 group 1
     6  
     7  // Package line 1 - group 2
     8  // Package line 2 - group 2
     9  package comments
    10  
    11  // Emit line 1 group 1
    12  
    13  // Emit line 1 group 2
    14  // Emit line 2 group 2
    15  {
    16      // Inside Emit
    17  }
    18  
    19  a: 3 // a line comment
    20  
    21  b: 4 // line comment that is last in the file.
    22  cc: 555 // align comments
    23  
    24  // don't simplify
    25  a: {
    26      b: 2
    27  }
    28  
    29  // simplify
    30  a: {
    31      b: c: {
    32          d: 1
    33      }
    34  }
    35  
    36  // unchanged
    37  a: b: [1]
    38  
    39  // don't simplify
    40  a: b: {
    41      c: 2
    42  }
    43  
    44  // rewrite okay
    45  a: b: c: {
    46      d: 2
    47  }
    48  
    49  m: {
    50  }
    51  m: {
    52      // empty with comment
    53  }
    54  
    55  // Issue #478
    56  struct1: {
    57      // This is a comment
    58  
    59      // This is a comment
    60  
    61      // Another comment
    62  
    63      something: {
    64      }
    65      // extra comment
    66  }
    67  
    68  struct2: {
    69      // This is a comment
    70  
    71      // This is a comment
    72  
    73      // Another comment
    74      something: {
    75      }
    76  
    77      // extra comment
    78  }
    79  
    80  list1: [
    81      // Comment1
    82  
    83      // Comment2
    84  
    85      // Another comment
    86      {
    87      },
    88  
    89      // Comment 3
    90  ]
    91  
    92  list2: [
    93      // foo
    94  ]
    95  
    96  list3: [
    97      // foo
    98  
    99      // bar
   100  ]
   101  
   102  list4: [
   103    1, // number
   104    a.b, // selector
   105    (a), // paren
   106    +1, // unary
   107    a[0], // index
   108    a[2:3],  // slice
   109    strings.Sort([1, 2]), // call
   110  
   111    a.b,
   112    // under selector
   113  
   114    a.b,
   115    // multiple
   116    // under
   117  
   118    // selector
   119  ]
   120  
   121  funcArg1: foo(
   122      // Comment1
   123  
   124      // Comment2
   125      3
   126  
   127      // Comment3
   128  )
   129  
   130  funcArg2: foo(
   131      // Comment1
   132  
   133      // Comment2
   134  
   135      3
   136      // Comment3
   137  )
   138  
   139  funcArg3: foo(
   140      2,
   141  
   142      // Comment1
   143  
   144      // Comment2
   145      3
   146  
   147      // Comment3
   148  )
   149  
   150  //	comment including		some tabs
   151  
   152  
   153  // issue #2567
   154  foo: [
   155   	bar["baz"], //some comment
   156  ]
   157  
   158  [
   159  	if true // inline comment
   160  	{}]
   161  
   162  {
   163      // comments
   164      ... // surrounding
   165  
   166      // an ellipsis
   167  
   168      foo: {
   169          // some
   170          [string]: _ // comment
   171      }
   172  }
   173  -- comments.golden --
   174  // Package line 1 group 1
   175  // Package line 2 group 1
   176  
   177  // Package line 1 - group 2
   178  // Package line 2 - group 2
   179  package comments
   180  
   181  // Emit line 1 group 1
   182  
   183  // Emit line 1 group 2
   184  // Emit line 2 group 2
   185  {
   186  	// Inside Emit
   187  }
   188  
   189  a: 3 // a line comment
   190  
   191  b:  4   // line comment that is last in the file.
   192  cc: 555 // align comments
   193  
   194  // don't simplify
   195  a: {
   196  	b: 2
   197  }
   198  
   199  // simplify
   200  a: {
   201  	b: c: d: 1
   202  }
   203  
   204  // unchanged
   205  a: b: [1]
   206  
   207  // don't simplify
   208  a: b: c: 2
   209  
   210  // rewrite okay
   211  a: b: c: d: 2
   212  
   213  m: {}
   214  m: {
   215  	// empty with comment
   216  }
   217  
   218  // Issue #478
   219  struct1: {
   220  	// This is a comment
   221  
   222  	// This is a comment
   223  
   224  	// Another comment
   225  
   226  	something: {}
   227  	// extra comment
   228  }
   229  
   230  struct2: {
   231  	// This is a comment
   232  
   233  	// This is a comment
   234  
   235  	// Another comment
   236  	something: {}
   237  
   238  	// extra comment
   239  }
   240  
   241  list1: [
   242  	// Comment1
   243  
   244  	// Comment2
   245  
   246  	// Another comment
   247  	{},
   248  
   249  	// Comment 3
   250  ]
   251  
   252  list2: [
   253  	// foo
   254  ]
   255  
   256  list3: [
   257  	// foo
   258  
   259  	// bar
   260  ]
   261  
   262  list4: [
   263  	1,                    // number
   264  	a.b,                  // selector
   265  	(a),                  // paren
   266  	+1,                   // unary
   267  	a[0],                 // index
   268  	a[2:3],               // slice
   269  	strings.Sort([1, 2]), // call
   270  
   271  	a.b,
   272  	// under selector
   273  
   274  	a.b,
   275  	// multiple
   276  	// under
   277  
   278  	// selector
   279  ]
   280  
   281  funcArg1: foo(
   282  		// Comment1
   283  
   284  	// Comment2
   285  	3,
   286  
   287  	// Comment3
   288  	)
   289  
   290  funcArg2: foo(
   291  		// Comment1
   292  
   293  	// Comment2
   294  
   295  	3,
   296  	// Comment3
   297  	)
   298  
   299  funcArg3: foo(
   300  		2,
   301  
   302  	// Comment1
   303  
   304  	// Comment2
   305  	3,
   306  
   307  	// Comment3
   308  	)
   309  
   310  //	comment including		some tabs
   311  
   312  // issue #2567
   313  foo: [
   314  	bar["baz"], //some comment
   315  ]
   316  
   317  [
   318  	if true {}, // inline comment
   319  ]
   320  
   321  {
   322  
   323  	foo: {
   324  		// some
   325  		... // comment
   326  	}
   327  	// comments
   328  	... // surrounding
   329  
   330  	// an ellipsis
   331  }
   332  -- comment_alone.input --
   333  // Just one comment on its own.
   334  -- comment_alone.golden --
   335  // Just one comment on its own.
   336  -- comment_field.input --
   337  // Just one comment on a field.
   338  foo: string
   339  -- comment_field.golden --
   340  // Just one comment on a field.
   341  foo: string
   342  -- comments_alone.input --
   343  // Just a few comments
   344  // on their own.
   345  -- comments_alone.golden --
   346  // Just a few comments
   347  // on their own.
   348  -- comments_field.input --
   349  // Just a few comments
   350  // on a field.
   351  foo: string
   352  -- comments_field.golden --
   353  // Just a few comments
   354  // on a field.
   355  foo: string