github.com/solo-io/cue@v0.4.7/cue/testdata/resolve/047_struct_comprehensions.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: struct comprehensions
     4  #evalPartial
     5  -- in.cue --
     6  obj: foo: a: "bar"
     7  obj: [Name=string]: {
     8  	a: *"dummy" | string
     9  	if true {
    10  		sub: as: a
    11  	}
    12  }
    13  
    14  for k, v in {#def: 1, opt?: 2, _hid: 3, reg: 4} {
    15  	"\(k)": v
    16  }
    17  -- out/def --
    18  obj: {
    19  	{[Name=string]: {
    20  		a: *"dummy" | string, sub: {
    21  			as: a
    22  		}
    23  	}}
    24  	foo: {
    25  		a: "bar"
    26  		sub: {
    27  			as: "bar"
    28  		}
    29  	}
    30  }
    31  reg: 4
    32  -- out/export --
    33  obj: {
    34  	foo: {
    35  		a: "bar"
    36  		sub: {
    37  			as: "bar"
    38  		}
    39  	}
    40  }
    41  reg: 4
    42  -- out/yaml --
    43  obj:
    44    foo:
    45      a: bar
    46      sub:
    47        as: bar
    48  reg: 4
    49  -- out/json --
    50  {"obj":{"foo":{"a":"bar","sub":{"as":"bar"}}},"reg":4}
    51  -- out/legacy-debug --
    52  <0>{obj: <1>{[]: <2>(Name: string)-><3>{a: (*"dummy" | string) if true yield <4>{sub: <5>{as: <3>.a}}}, foo: <6>{a: "bar", sub: <7>{as: "bar"}}}, reg: 4}
    53  -- out/compile --
    54  --- in.cue
    55  {
    56    obj: {
    57      foo: {
    58        a: "bar"
    59      }
    60    }
    61    obj: {
    62      [string]: {
    63        a: (*"dummy"|string)
    64        if true {
    65          sub: {
    66            as: 〈2;a〉
    67          }
    68        }
    69      }
    70    }
    71    for k, v in {
    72      #def: 1
    73      opt?: 2
    74      _hid: 3
    75      reg: 4
    76    } {
    77      "\(〈1;k〉)": 〈1;v〉
    78    }
    79  }
    80  -- out/eval --
    81  (struct){
    82    obj: (struct){
    83      foo: (struct){
    84        a: (string){ "bar" }
    85        sub: (struct){
    86          as: (string){ "bar" }
    87        }
    88      }
    89    }
    90    reg: (int){ 4 }
    91  }