cuelang.org/go@v0.10.1/cue/testdata/builtins/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/stats --
    79  Leaks:  0
    80  Freed:  45
    81  Reused: 39
    82  Allocs: 6
    83  Retain: 17
    84  
    85  Unifications: 45
    86  Conjuncts:    77
    87  Disjuncts:    62
    88  -- out/eval --
    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        //     ./in.cue:15:3
   100      }
   101    }
   102    #V: (#struct){
   103      s: (string){ string }
   104      out: (_|_){
   105        // [incomplete] cannot convert incomplete value "string" to JSON:
   106        //     ./in.cue:20:7
   107      }
   108    }
   109    #U: (#struct){
   110      s: (string){ string }
   111      out: (_|_){
   112        // [incomplete] #U.out: error in call to encoding/yaml.Marshal: incomplete value string:
   113        //     ./in.cue:26:7
   114        //     ./in.cue:25:7
   115      }
   116    }
   117  }
   118  -- out/compile --
   119  --- in.cue
   120  {
   121    x: {
   122      s: "myname"
   123      〈1;#T〉
   124    }
   125    #T: {
   126      s: string
   127      out: 〈import;"text/template"〉.Execute("{{.s}}", {
   128        s: 〈1;s〉
   129      })
   130    }
   131    #V: {
   132      s: string
   133      out: 〈import;"encoding/json"〉.Marshal({
   134        s: 〈1;s〉
   135      })
   136    }
   137    #U: {
   138      s: string
   139      out: 〈import;"encoding/yaml"〉.Marshal({
   140        s: 〈1;s〉
   141      })
   142    }
   143  }