...

Text file src/cuelang.org/go/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar

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

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: json Marshaling detects incomplete
     4#evalFull
     5-- in.cue --
     6import "encoding/json"
     7
     8a: json.Marshal({a: string})
     9
    10foo: {a: 3, b: foo.c}
    11b: json.Marshal(foo)
    12-- out/def --
    13import "encoding/json"
    14
    15a: json.Marshal({
    16	a: string
    17})
    18foo: {
    19	a: 3
    20	b: foo.c
    21}
    22b: json.Marshal(foo)
    23-- out/legacy-debug --
    24<0>{a: <1>.Marshal (<2>{a: string}), foo: <3>{a: 3, b: <4>.foo.c}, b: <1>.Marshal (<4>.foo)}
    25-- out/eval/stats --
    26Leaks:  0
    27Freed:  16
    28Reused: 12
    29Allocs: 4
    30Retain: 5
    31
    32Unifications: 16
    33Conjuncts:    24
    34Disjuncts:    21
    35-- out/eval --
    36(struct){
    37  a: (_|_){
    38    // [incomplete] cannot convert incomplete value "string" to JSON:
    39    //     ./in.cue:3:21
    40  }
    41  foo: (struct){
    42    a: (int){ 3 }
    43    b: (_|_){
    44      // [incomplete] foo.b: undefined field: c:
    45      //     ./in.cue:5:20
    46    }
    47  }
    48  b: (_|_){
    49    // [incomplete] foo.b: undefined field: c:
    50    //     ./in.cue:5:20
    51  }
    52}
    53-- out/compile --
    54--- in.cue
    55{
    56  a: 〈import;"encoding/json"〉.Marshal({
    57    a: string
    58  })
    59  foo: {
    60    a: 3
    61    b: 〈1;foo〉.c
    62  }
    63  b: 〈import;"encoding/json"〉.Marshal(〈0;foo〉)
    64}

View as plain text