...

Text file src/cuelang.org/go/cue/testdata/fulleval/016_struct_comprehension_with_template.txtar

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

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: struct comprehension with template
     4#evalFull
     5-- in.cue --
     6result: [for _, v in service {v}]
     7
     8service: [Name=string]: {
     9	name: *Name | string
    10	type: "service"
    11	port: *7080 | int
    12}
    13service: foo: {}
    14service: bar: {port: 8000}
    15service: baz: {name: "foobar"}
    16-- out/def --
    17result: [{
    18	name: *"foo" | string
    19	type: "service"
    20	port: *7080 | int
    21}, {
    22	name: *"bar" | string
    23	type: "service"
    24	port: 8000
    25}, {
    26	name: "foobar"
    27	type: "service"
    28	port: *7080 | int
    29}]
    30service: {
    31	{[Name=string]: {
    32		name: *Name | string, type: "service", port: *7080 | int
    33	}}
    34	foo: {
    35		name: *"foo" | string
    36		type: "service"
    37		port: *7080 | int
    38	}
    39	bar: {
    40		name: *"bar" | string
    41		type: "service"
    42		port: 8000
    43	}
    44	baz: {
    45		name: "foobar"
    46		type: "service"
    47		port: *7080 | int
    48	}
    49}
    50-- out/export --
    51result: [{
    52	name: "foo"
    53	type: "service"
    54	port: 7080
    55}, {
    56	name: "bar"
    57	type: "service"
    58	port: 8000
    59}, {
    60	name: "foobar"
    61	type: "service"
    62	port: 7080
    63}]
    64service: {
    65	foo: {
    66		name: "foo"
    67		type: "service"
    68		port: 7080
    69	}
    70	bar: {
    71		name: "bar"
    72		type: "service"
    73		port: 8000
    74	}
    75	baz: {
    76		name: "foobar"
    77		type: "service"
    78		port: 7080
    79	}
    80}
    81-- out/yaml --
    82result:
    83- name: foo
    84  type: service
    85  port: 7080
    86- name: bar
    87  type: service
    88  port: 8000
    89- name: foobar
    90  type: service
    91  port: 7080
    92service:
    93  foo:
    94    name: foo
    95    type: service
    96    port: 7080
    97  bar:
    98    name: bar
    99    type: service
   100    port: 8000
   101  baz:
   102    name: foobar
   103    type: service
   104    port: 7080
   105-- out/json --
   106{"result":[{"name":"foo","type":"service","port":7080},{"name":"bar","type":"service","port":8000},{"name":"foobar","type":"service","port":7080}],"service":{"foo":{"name":"foo","type":"service","port":7080},"bar":{"name":"bar","type":"service","port":8000},"baz":{"name":"foobar","type":"service","port":7080}}}
   107-- out/legacy-debug --
   108<0>{result: [<1>{name: "foo", type: "service", port: 7080},<2>{name: "bar", type: "service", port: 8000},<3>{name: "foobar", type: "service", port: 7080}], service: <4>{[]: <5>(Name: string)-><6>{name: (*<5>.Name | string), type: "service", port: (*7080 | int)}, foo: <7>{name: "foo", type: "service", port: 7080}, bar: <8>{name: "bar", type: "service", port: 8000}, baz: <9>{name: "foobar", type: "service", port: 7080}}}
   109-- out/compile --
   110--- in.cue
   111{
   112  result: [
   113    for _, v in 〈1;service〉 {
   114      〈1;v〉
   115    },
   116  ]
   117  service: {
   118    [string]: {
   119      name: (*〈1;-〉|string)
   120      type: "service"
   121      port: (*7080|int)
   122    }
   123  }
   124  service: {
   125    foo: {}
   126  }
   127  service: {
   128    bar: {
   129      port: 8000
   130    }
   131  }
   132  service: {
   133    baz: {
   134      name: "foobar"
   135    }
   136  }
   137}
   138-- out/eval/stats --
   139Leaks:  0
   140Freed:  51
   141Reused: 43
   142Allocs: 8
   143Retain: 4
   144
   145Unifications: 27
   146Conjuncts:    70
   147Disjuncts:    55
   148-- out/eval --
   149(struct){
   150  result: (#list){
   151    0: (struct){
   152      name: (string){ |(*(string){ "foo" }, (string){ string }) }
   153      type: (string){ "service" }
   154      port: (int){ |(*(int){ 7080 }, (int){ int }) }
   155    }
   156    1: (struct){
   157      port: (int){ 8000 }
   158      name: (string){ |(*(string){ "bar" }, (string){ string }) }
   159      type: (string){ "service" }
   160    }
   161    2: (struct){
   162      name: (string){ "foobar" }
   163      type: (string){ "service" }
   164      port: (int){ |(*(int){ 7080 }, (int){ int }) }
   165    }
   166  }
   167  service: (struct){
   168    foo: (struct){
   169      name: (string){ |(*(string){ "foo" }, (string){ string }) }
   170      type: (string){ "service" }
   171      port: (int){ |(*(int){ 7080 }, (int){ int }) }
   172    }
   173    bar: (struct){
   174      port: (int){ 8000 }
   175      name: (string){ |(*(string){ "bar" }, (string){ string }) }
   176      type: (string){ "service" }
   177    }
   178    baz: (struct){
   179      name: (string){ "foobar" }
   180      type: (string){ "service" }
   181      port: (int){ |(*(int){ 7080 }, (int){ int }) }
   182    }
   183  }
   184}

View as plain text