github.com/solo-io/cue@v0.4.7/cue/testdata/fulleval/056_issue314.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: issue314
     4  #evalFull
     5  -- in.cue --
     6  import (
     7  	"text/template"
     8  	"encoding/yaml"
     9  	"encoding/json"
    10  )
    11  
    12  x: {
    13  	s: "myname"
    14  	#T
    15  }
    16  
    17  #T: {
    18  	s:   string
    19  	out: template.Execute("{{.s}}", {
    20  		"s": s
    21  	})
    22  }
    23  
    24  #V: {
    25  	s:   string
    26  	out: json.Marshal({"s": s})
    27  }
    28  
    29  #U: {
    30  	s:   string
    31  	out: yaml.Marshal({"s": s})
    32  }
    33  -- out/def --
    34  import (
    35  	"encoding/json"
    36  	"encoding/yaml"
    37  	"text/template"
    38  )
    39  
    40  x: {
    41  	s: "myname"
    42  	#T
    43  }
    44  #T: {
    45  	s: string
    46  	S = s
    47  	out: template.Execute("{{.s}}", {
    48  		s: S
    49  	})
    50  }
    51  #V: {
    52  	s: string
    53  	S658221 = s
    54  	out: json.Marshal({
    55  		s: S658221
    56  	})
    57  }
    58  #U: {
    59  	s: string
    60  	S629a0f = s
    61  	out: yaml.Marshal({
    62  		s: S629a0f
    63  	})
    64  }
    65  -- out/export --
    66  x: {
    67  	s:   "myname"
    68  	out: "myname"
    69  }
    70  -- out/yaml --
    71  x:
    72    s: myname
    73    out: myname
    74  -- out/json --
    75  {"x":{"s":"myname","out":"myname"}}
    76  -- out/legacy-debug --
    77  <0>{x: <1>C{s: "myname", out: "myname"}, #T: <2>C{s: string, out: <3>.Execute ("{{.s}}",<4>C{s: <5>.s})}, #V: <6>C{s: string, out: <7>.Marshal (<8>C{s: <9>.s})}, #U: <10>C{s: string, out: <11>.Marshal (<12>C{s: <13>.s})}}
    78  -- out/eval --
    79  (struct){
    80    x: (#struct){
    81      s: (string){ "myname" }
    82      out: (string){ "myname" }
    83    }
    84    #T: (#struct){
    85      s: (string){ string }
    86      out: (_|_){
    87        // [incomplete] error in call to text/template.Execute: cannot convert non-concrete value string:
    88        //     ./in.cue:14:7
    89        //     ./in.cue:15:3
    90      }
    91    }
    92    #V: (#struct){
    93      s: (string){ string }
    94      out: (_|_){
    95        // [incomplete] cannot convert incomplete value "string" to JSON
    96      }
    97    }
    98    #U: (#struct){
    99      s: (string){ string }
   100      out: (_|_){
   101        // [incomplete] #U.out: incomplete value:
   102        //     ./in.cue:26:7
   103      }
   104    }
   105  }
   106  -- out/compile --
   107  --- in.cue
   108  {
   109    x: {
   110      s: "myname"
   111      〈1;#T〉
   112    }
   113    #T: {
   114      s: string
   115      out: 〈import;"text/template"〉.Execute("{{.s}}", {
   116        s: 〈1;s〉
   117      })
   118    }
   119    #V: {
   120      s: string
   121      out: 〈import;"encoding/json"〉.Marshal({
   122        s: 〈1;s〉
   123      })
   124    }
   125    #U: {
   126      s: string
   127      out: 〈import;"encoding/yaml"〉.Marshal({
   128        s: 〈1;s〉
   129      })
   130    }
   131  }