github.com/solo-io/cue@v0.4.7/internal/core/export/testdata/let.txtar (about)

     1  # Issue #590
     2  
     3  -- in.cue --
     4  let X = 1 + 1
     5  #Foo: X
     6  -- x.cue --
     7  x: string
     8  
     9  let Y = x
    10  y: Y
    11  -- y.cue --
    12  x: "foo"
    13  
    14  // Note: although syntactically the same, this is a different let clause than
    15  // the one from before and thus will be renamed.
    16  // Issue #590
    17  let Y = x
    18  y: Y
    19  -- issue593.cue --
    20  cfgs: [ for crd in ["one", "two"] {
    21          metadata: {
    22                  name: crd
    23          }
    24  }]
    25  for cfg in cfgs {
    26          let filepath = "kind-\(cfg.name)"
    27          files: {
    28                  "\(filepath)": {
    29                          patches: cfg
    30                  }
    31          }
    32  }
    33  
    34  -- out/definition --
    35  
    36  {
    37  	cfgs: [ for crd in ["one", "two"] {
    38  		metadata: {
    39  			name: crd
    40  		}
    41  	}]
    42  	for cfg in cfgs {
    43  		let filepath = "kind-\(cfg.name)"
    44  		files: {
    45  			"\(filepath)": {
    46  				patches: cfg
    47  			}
    48  		}
    49  	}
    50  }
    51  let X = 1 + 1
    52  #Foo: X
    53  x:    "foo"
    54  let Y = x
    55  let Y_1 = x
    56  y: Y & Y_1
    57  -- out/doc --
    58  []
    59  [#Foo]
    60  [x]
    61  [y]
    62  [cfgs]
    63  [cfgs 0]
    64  [cfgs 0 metadata]
    65  [cfgs 0 metadata name]
    66  [cfgs 1]
    67  [cfgs 1 metadata]
    68  [cfgs 1 metadata name]
    69  [files]
    70  -- out/value --
    71  == Simplified
    72  {
    73  	x: "foo"
    74  	cfgs: [{
    75  		metadata: {
    76  			name: "one"
    77  		}
    78  	}, {
    79  		metadata: {
    80  			name: "two"
    81  		}
    82  	}]
    83  	let filepath = "kind-\(cfg.name)"
    84  	files: {
    85  		"\(filepath)": {
    86  			patches: cfg
    87  		}
    88  	} & {
    89  		"\(filepath)": {
    90  			patches: cfg
    91  		}
    92  	}
    93  	y: "foo"
    94  }
    95  == Raw
    96  {
    97  	#Foo: 2
    98  	x:    "foo"
    99  	cfgs: [{
   100  		metadata: {
   101  			name: "one"
   102  		}
   103  	}, {
   104  		metadata: {
   105  			name: "two"
   106  		}
   107  	}]
   108  	let filepath = "kind-\(cfg.name)"
   109  	files: {
   110  		"\(filepath)": {
   111  			patches: cfg
   112  		}
   113  	} & {
   114  		"\(filepath)": {
   115  			patches: cfg
   116  		}
   117  	}
   118  	y: "foo"
   119  }
   120  == Final
   121  {
   122  	x: "foo"
   123  	cfgs: [{
   124  		metadata: {
   125  			name: "one"
   126  		}
   127  	}, {
   128  		metadata: {
   129  			name: "two"
   130  		}
   131  	}]
   132  	files: _|_ // invalid interpolation: invalid interpolation: files: undefined field: name (and 3 more errors)
   133  	y:     "foo"
   134  }
   135  == All
   136  {
   137  	#Foo: 2
   138  	x:    "foo"
   139  	cfgs: [{
   140  		metadata: {
   141  			name: "one"
   142  		}
   143  	}, {
   144  		metadata: {
   145  			name: "two"
   146  		}
   147  	}]
   148  	let filepath = "kind-\(cfg.name)"
   149  	files: {
   150  		"\(filepath)": {
   151  			patches: cfg
   152  		}
   153  	} & {
   154  		"\(filepath)": {
   155  			patches: cfg
   156  		}
   157  	}
   158  	y: "foo"
   159  }
   160  == Eval
   161  {
   162  	#Foo: 2
   163  	x:    "foo"
   164  	cfgs: [{
   165  		metadata: {
   166  			name: "one"
   167  		}
   168  	}, {
   169  		metadata: {
   170  			name: "two"
   171  		}
   172  	}]
   173  	let filepath = "kind-\(cfg.name)"
   174  	files: {
   175  		"\(filepath)": {
   176  			patches: cfg
   177  		}
   178  	} & {
   179  		"\(filepath)": {
   180  			patches: cfg
   181  		}
   182  	}
   183  	y: "foo"
   184  }