cuelang.org/go@v0.13.0/tools/trim/testdata/optional.txtar (about)

     1  // Optional fields should retain status after removal of unified
     2  // content.
     3  
     4  // Issue #855
     5  
     6  -- cue.mod/module.cue --
     7  module: "mod.test"
     8  language: version: "v0.9.0"
     9  -- a.cue --
    10  package pkg
    11  
    12  a: [...#A]
    13  
    14  a: [{
    15  	annotations: {}
    16  }]
    17  
    18  #A: annotations?: [string]: string
    19  
    20  b: #B
    21  b: bb: c:   2 // c can be removed, bb not.
    22  #B: bb?: c: 2
    23  -- out/trim-v3 --
    24  == a.cue
    25  package pkg
    26  
    27  a: [...#A]
    28  
    29  a: [{
    30  	annotations: {}
    31  }]
    32  
    33  #A: annotations?: [string]: string
    34  
    35  b: #B
    36  b: bb: _ // c can be removed, bb not.
    37  #B: bb?: c: 2
    38  -- diff/-out/trim-v3<==>+out/trim --
    39  diff old new
    40  --- old
    41  +++ new
    42  @@ -9,6 +9,6 @@
    43   
    44   #A: annotations?: [string]: string
    45   
    46  -b:        #B
    47  -b: bb: {} // c can be removed, bb not.
    48  +b: #B
    49  +b: bb: _ // c can be removed, bb not.
    50   #B: bb?: c: 2
    51  -- out/trim-v3-noshare --
    52  == a.cue
    53  package pkg
    54  
    55  a: [...#A]
    56  
    57  a: [{
    58  	annotations: {}
    59  }]
    60  
    61  #A: annotations?: [string]: string
    62  
    63  b: #B
    64  b: bb: _ // c can be removed, bb not.
    65  #B: bb?: c: 2
    66  -- diff/-out/trim-v3-noshare<==>+out/trim --
    67  diff old new
    68  --- old
    69  +++ new
    70  @@ -9,6 +9,6 @@
    71   
    72   #A: annotations?: [string]: string
    73   
    74  -b:        #B
    75  -b: bb: {} // c can be removed, bb not.
    76  +b: #B
    77  +b: bb: _ // c can be removed, bb not.
    78   #B: bb?: c: 2
    79  -- out/trim --
    80  == a.cue
    81  package pkg
    82  
    83  a: [...#A]
    84  
    85  a: [{
    86  	annotations: {}
    87  }]
    88  
    89  #A: annotations?: [string]: string
    90  
    91  b:        #B
    92  b: bb: {} // c can be removed, bb not.
    93  #B: bb?: c: 2