...

Text file src/cuelang.org/go/cue/testdata/builtins/056_issue314.txtar

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

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: issue314
     4#evalFull
     5-- in.cue --
     6import (
     7	"text/template"
     8	"encoding/yaml"
     9	"encoding/json"
    10)
    11
    12x: {
    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 --
    34import (
    35	"encoding/json"
    36	"encoding/yaml"
    37	"text/template"
    38)
    39
    40x: {
    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 --
    66x: {
    67	s:   "myname"
    68	out: "myname"
    69}
    70-- out/yaml --
    71x:
    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/stats --
    79Leaks:  0
    80Freed:  45
    81Reused: 39
    82Allocs: 6
    83Retain: 17
    84
    85Unifications: 45
    86Conjuncts:    77
    87Disjuncts:    62
    88-- out/evalalpha --
    89(struct){
    90  x: (#struct){
    91    s: (string){ "myname" }
    92    out: (string){ "myname" }
    93  }
    94  #T: (#struct){
    95    s: (string){ string }
    96    out: (_|_){
    97      // [incomplete] #T.out: error in call to text/template.Execute: cannot convert non-concrete value string:
    98      //     ./in.cue:14:7
    99    }
   100  }
   101  #V: (#struct){
   102    s: (string){ string }
   103    out: (_|_){
   104      // [incomplete] cannot convert incomplete value "string" to JSON:
   105      //     ./in.cue:20:7
   106    }
   107  }
   108  #U: (#struct){
   109    s: (string){ string }
   110    out: (_|_){
   111      // [incomplete] #U.out: error in call to encoding/yaml.Marshal: incomplete value string:
   112      //     ./in.cue:26:7
   113      //     ./in.cue:25:7
   114    }
   115  }
   116}
   117-- diff/-out/evalalpha<==>+out/eval --
   118diff old new
   119--- old
   120+++ new
   121@@ -8,7 +8,6 @@
   122     out: (_|_){
   123       // [incomplete] #T.out: error in call to text/template.Execute: cannot convert non-concrete value string:
   124       //     ./in.cue:14:7
   125-      //     ./in.cue:15:3
   126     }
   127   }
   128   #V: (#struct){
   129-- diff/todo/p2 --
   130error positions
   131-- out/eval --
   132(struct){
   133  x: (#struct){
   134    s: (string){ "myname" }
   135    out: (string){ "myname" }
   136  }
   137  #T: (#struct){
   138    s: (string){ string }
   139    out: (_|_){
   140      // [incomplete] #T.out: error in call to text/template.Execute: cannot convert non-concrete value string:
   141      //     ./in.cue:14:7
   142      //     ./in.cue:15:3
   143    }
   144  }
   145  #V: (#struct){
   146    s: (string){ string }
   147    out: (_|_){
   148      // [incomplete] cannot convert incomplete value "string" to JSON:
   149      //     ./in.cue:20:7
   150    }
   151  }
   152  #U: (#struct){
   153    s: (string){ string }
   154    out: (_|_){
   155      // [incomplete] #U.out: error in call to encoding/yaml.Marshal: incomplete value string:
   156      //     ./in.cue:26:7
   157      //     ./in.cue:25:7
   158    }
   159  }
   160}
   161-- out/compile --
   162--- in.cue
   163{
   164  x: {
   165    s: "myname"
   166    〈1;#T〉
   167  }
   168  #T: {
   169    s: string
   170    out: 〈import;"text/template"〉.Execute("{{.s}}", {
   171      s: 〈1;s〉
   172    })
   173  }
   174  #V: {
   175    s: string
   176    out: 〈import;"encoding/json"〉.Marshal({
   177      s: 〈1;s〉
   178    })
   179  }
   180  #U: {
   181    s: string
   182    out: 〈import;"encoding/yaml"〉.Marshal({
   183      s: 〈1;s〉
   184    })
   185  }
   186}

View as plain text