...

Text file src/cuelang.org/go/cue/testdata/eval/discontinuous.txtar

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

     1This test tests a case where a child node needs to be evaluated
     2before evaluating a parent has completed.
     3
     4-- in.cue --
     5a: [for c in foo.bar.baz {
     6	c
     7}]
     8
     9a: [{name: "http"}]
    10
    11foo: {
    12	x.D
    13
    14	bar: baz: [{port: 8080}]
    15}
    16
    17x: {
    18	D: bar: DSpec
    19	DSpec: {}
    20}
    21-- out/compile --
    22--- in.cue
    23{
    24  a: [
    25    for _, c in 〈1;foo〉.bar.baz {
    26      〈1;c〉
    27    },
    28  ]
    29  a: [
    30    {
    31      name: "http"
    32    },
    33  ]
    34  foo: {
    35    〈1;x〉.D
    36    bar: {
    37      baz: [
    38        {
    39          port: 8080
    40        },
    41      ]
    42    }
    43  }
    44  x: {
    45    D: {
    46      bar: 〈1;DSpec〉
    47    }
    48    DSpec: {}
    49  }
    50}
    51-- out/eval/stats --
    52Leaks:  0
    53Freed:  14
    54Reused: 5
    55Allocs: 9
    56Retain: 9
    57
    58Unifications: 14
    59Conjuncts:    23
    60Disjuncts:    23
    61-- out/evalalpha --
    62(struct){
    63  a: (#list){
    64    0: (struct){
    65      name: (string){ "http" }
    66      port: (int){ 8080 }
    67    }
    68  }
    69  foo: (struct){
    70    bar: (struct){
    71      baz: (#list){
    72        0: (struct){
    73          port: (int){ 8080 }
    74        }
    75      }
    76    }
    77  }
    78  x: (struct){
    79    D: (struct){
    80      bar: (struct){
    81      }
    82    }
    83    DSpec: (struct){
    84    }
    85  }
    86}
    87-- diff/-out/evalalpha<==>+out/eval --
    88diff old new
    89--- old
    90+++ new
    91@@ -1,8 +1,8 @@
    92 (struct){
    93   a: (#list){
    94     0: (struct){
    95-      port: (int){ 8080 }
    96       name: (string){ "http" }
    97+      port: (int){ 8080 }
    98     }
    99   }
   100   foo: (struct){
   101-- diff/explanation --
   102Reordering.
   103-- out/eval --
   104(struct){
   105  a: (#list){
   106    0: (struct){
   107      port: (int){ 8080 }
   108      name: (string){ "http" }
   109    }
   110  }
   111  foo: (struct){
   112    bar: (struct){
   113      baz: (#list){
   114        0: (struct){
   115          port: (int){ 8080 }
   116        }
   117      }
   118    }
   119  }
   120  x: (struct){
   121    D: (struct){
   122      bar: (struct){
   123      }
   124    }
   125    DSpec: (struct){
   126    }
   127  }
   128}

View as plain text