cuelang.org/go@v0.10.1/internal/core/export/testdata/main/comprehensions.txtar (about)

     1  -- a.cue --
     2  dropEmpty: {
     3  	k: "a"
     4  	#A: {
     5  		b:  !=""
     6  
     7  		if k == "a" {
     8  			d: "\(b)"
     9  		}
    10  		if k == "b" {
    11  			d: ""
    12  		}
    13  	}
    14  	a: #A
    15  	a: b: "c"
    16  }
    17  nested: {
    18  	if true
    19  	if true
    20  
    21  	let x = [1]
    22  	for y in x {
    23  		y
    24  	}
    25  }
    26  -- out/definition --
    27  dropEmpty: {
    28  	k: "a"
    29  	#A: {
    30  		b: !=""
    31  
    32  		if k == "a" {
    33  			d: "\(b)"
    34  		}
    35  		if k == "b" {
    36  			d: ""
    37  		}
    38  	}
    39  	a: #A & {
    40  		b: "c"
    41  	}
    42  }
    43  nested: {
    44  	if true
    45  	if true
    46  
    47  	let x = [1]
    48  	for y in x {
    49  		y
    50  	}
    51  }
    52  -- out/doc --
    53  []
    54  [dropEmpty]
    55  [dropEmpty k]
    56  [dropEmpty #A]
    57  [dropEmpty #A b]
    58  [dropEmpty #A d]
    59  [dropEmpty a]
    60  [dropEmpty a b]
    61  [dropEmpty a d]
    62  [nested]
    63  -- out/value --
    64  == Simplified
    65  {
    66  	dropEmpty: {
    67  		k: "a"
    68  		a: {
    69  			b: "c"
    70  			d: "c"
    71  		}
    72  	}
    73  	nested: 1
    74  }
    75  == Raw
    76  {
    77  	dropEmpty: {
    78  		k: "a"
    79  		#A: {
    80  			b: !=""
    81  			d: "\(b)"
    82  		}
    83  		a: {
    84  			b: "c"
    85  			d: "c"
    86  		}
    87  	}
    88  	nested: 1
    89  }
    90  == Final
    91  {
    92  	dropEmpty: {
    93  		k: "a"
    94  		a: {
    95  			b: "c"
    96  			d: "c"
    97  		}
    98  	}
    99  	nested: 1
   100  }
   101  == All
   102  {
   103  	dropEmpty: {
   104  		k: "a"
   105  		#A: {
   106  			b: !=""
   107  			d: "\(b)"
   108  		}
   109  		a: {
   110  			b: "c"
   111  			d: "c"
   112  		}
   113  	}
   114  	nested: 1
   115  }
   116  == Eval
   117  {
   118  	dropEmpty: {
   119  		k: "a"
   120  		#A: {
   121  			b: !=""
   122  			d: "\(b)"
   123  		}
   124  		a: {
   125  			b: "c"
   126  			d: "c"
   127  		}
   128  	}
   129  	nested: 1
   130  }