github.com/solo-io/cue@v0.4.7/cue/testdata/references/errors.txtar (about)

     1  -- references.cue --
     2  
     3  missingField: {
     4      a: {}
     5      r: a.b
     6  }
     7  
     8  missingFieldClosed: {
     9      #a: {}
    10      r: #a.b
    11  }
    12  
    13  missingFieldNested: {
    14      a: {}
    15      // Must refer to `b` in error
    16      r: a.b.c
    17  }
    18  
    19  missingFieldNestedClosed: {
    20      #a: {}
    21      // Must refer to `d` in error
    22      r: #a.d.c
    23  }
    24  
    25  missingFieldNestedInInterpolation: {
    26      a: {}
    27      // Must refer to `b` in error
    28      r1: "\(a.b.c)"
    29      // Must refer to `d` in error: in case only one error is shown for a
    30      // a location, ensure it doesn't alphabetically sort and pick `c` instead.
    31      r2: "\(a.d.c)"
    32  }
    33  -- out/eval --
    34  Errors:
    35  missingFieldClosed.r: undefined field: b:
    36      ./references.cue:9:11
    37  missingFieldNestedClosed.r: undefined field: d:
    38      ./references.cue:21:11
    39  
    40  Result:
    41  (_|_){
    42    // [eval]
    43    missingField: (struct){
    44      a: (struct){
    45      }
    46      r: (_|_){
    47        // [incomplete] missingField.r: undefined field: b:
    48        //     ./references.cue:4:10
    49      }
    50    }
    51    missingFieldClosed: (_|_){
    52      // [eval]
    53      #a: (#struct){
    54      }
    55      r: (_|_){
    56        // [eval] missingFieldClosed.r: undefined field: b:
    57        //     ./references.cue:9:11
    58      }
    59    }
    60    missingFieldNested: (struct){
    61      a: (struct){
    62      }
    63      r: (_|_){
    64        // [incomplete] missingFieldNested.r: undefined field: b:
    65        //     ./references.cue:15:10
    66      }
    67    }
    68    missingFieldNestedClosed: (_|_){
    69      // [eval]
    70      #a: (#struct){
    71      }
    72      r: (_|_){
    73        // [eval] missingFieldNestedClosed.r: undefined field: d:
    74        //     ./references.cue:21:11
    75      }
    76    }
    77    missingFieldNestedInInterpolation: (struct){
    78      a: (struct){
    79      }
    80      r1: (_|_){
    81        // [incomplete] missingFieldNestedInInterpolation.r1: invalid interpolation: undefined field: b:
    82        //     ./references.cue:27:9
    83        //     ./references.cue:27:14
    84      }
    85      r2: (_|_){
    86        // [incomplete] missingFieldNestedInInterpolation.r2: invalid interpolation: undefined field: d:
    87        //     ./references.cue:30:9
    88        //     ./references.cue:30:14
    89      }
    90    }
    91  }
    92  -- out/compile --
    93  --- references.cue
    94  {
    95    missingField: {
    96      a: {}
    97      r: 〈0;a〉.b
    98    }
    99    missingFieldClosed: {
   100      #a: {}
   101      r: 〈0;#a〉.b
   102    }
   103    missingFieldNested: {
   104      a: {}
   105      r: 〈0;a〉.b.c
   106    }
   107    missingFieldNestedClosed: {
   108      #a: {}
   109      r: 〈0;#a〉.d.c
   110    }
   111    missingFieldNestedInInterpolation: {
   112      a: {}
   113      r1: "\(〈0;a〉.b.c)"
   114      r2: "\(〈0;a〉.d.c)"
   115    }
   116  }