...

Text file src/cuelang.org/go/cue/testdata/comprehensions/015_list_comprehension.txtar

Documentation: cuelang.org/go/cue/testdata/comprehensions

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: list comprehension
     4#evalFull
     5-- in.cue --
     6a: [for k, v in b if k < "d" if v > b.a {k}]
     7b: {
     8	a: 1
     9	b: 2
    10	c: 3
    11	d: 4
    12}
    13c: [for _, x in b for _, y in b if x < y {x}]
    14d: [for x, _ in a {x}]
    15-- out/def --
    16a: ["b", "c"]
    17b: {
    18	a: 1
    19	b: 2
    20	c: 3
    21	d: 4
    22}
    23c: [1, 1, 1, 2, 2, 3]
    24d: [0, 1]
    25-- out/export --
    26a: ["b", "c"]
    27b: {
    28	a: 1
    29	b: 2
    30	c: 3
    31	d: 4
    32}
    33c: [1, 1, 1, 2, 2, 3]
    34d: [0, 1]
    35-- out/yaml --
    36a:
    37- b
    38- c
    39b:
    40  a: 1
    41  b: 2
    42  c: 3
    43  d: 4
    44c:
    45- 1
    46- 1
    47- 1
    48- 2
    49- 2
    50- 3
    51d:
    52- 0
    53- 1
    54-- out/json --
    55{"a":["b","c"],"b":{"a":1,"b":2,"c":3,"d":4},"c":[1,1,1,2,2,3],"d":[0,1]}
    56-- out/legacy-debug --
    57<0>{a: ["b","c"], b: <1>{a: 1, b: 2, c: 3, d: 4}, c: [1,1,1,2,2,3], d: [0,1]}
    58-- out/compile --
    59--- in.cue
    60{
    61  a: [
    62    for k, v in 〈1;b〉 if (〈0;k〉 < "d") if (〈0;v〉 > 〈2;b〉.a) {
    63      〈1;k〉
    64    },
    65  ]
    66  b: {
    67    a: 1
    68    b: 2
    69    c: 3
    70    d: 4
    71  }
    72  c: [
    73    for _, x in 〈1;b〉 for _, y in 〈2;b〉 if (〈1;x〉 < 〈0;y〉) {
    74      〈2;x〉
    75    },
    76  ]
    77  d: [
    78    for x, _ in 〈1;a〉 {
    79      〈1;x〉
    80    },
    81  ]
    82}
    83-- out/eval/stats --
    84Leaks:  0
    85Freed:  19
    86Reused: 12
    87Allocs: 7
    88Retain: 10
    89
    90Unifications: 19
    91Conjuncts:    36
    92Disjuncts:    23
    93-- out/eval --
    94(struct){
    95  a: (#list){
    96    0: (string){ "b" }
    97    1: (string){ "c" }
    98  }
    99  b: (struct){
   100    a: (int){ 1 }
   101    b: (int){ 2 }
   102    c: (int){ 3 }
   103    d: (int){ 4 }
   104  }
   105  c: (#list){
   106    0: (int){ 1 }
   107    1: (int){ 1 }
   108    2: (int){ 1 }
   109    3: (int){ 2 }
   110    4: (int){ 2 }
   111    5: (int){ 3 }
   112  }
   113  d: (#list){
   114    0: (int){ 0 }
   115    1: (int){ 1 }
   116  }
   117}

View as plain text