cuelang.org/go@v0.10.1/cue/testdata/export/issue2119.txtar (about)

     1  -- in.cue --
     2  import (
     3  	"encoding/yaml"
     4  	"regexp"
     5  )
     6  
     7  simplified: {
     8  	x: d: R={
     9  		".*"
    10  		[R+""][0]
    11  	}
    12  	out: yaml.Marshal(x)
    13  }
    14  
    15  original: {
    16  	#testableRegexp: R={
    17  		string
    18  
    19  		#test: close({
    20  			in:  string
    21  			out: regexp.FindSubmatch("^"+R+"$", in)[1]
    22  		})
    23  	}
    24  
    25  	rule: {
    26  		#patterns: {
    27  			bar: #testableRegexp & {
    28  				"(.*)"
    29  				#test: {in: "testcontent", out: "testcontent"}
    30  			}
    31  		}
    32  	}
    33  	out: yaml.Marshal(rule)
    34  }
    35  -- out/eval/stats --
    36  Leaks:  4
    37  Freed:  20
    38  Reused: 11
    39  Allocs: 13
    40  Retain: 4
    41  
    42  Unifications: 24
    43  Conjuncts:    42
    44  Disjuncts:    24
    45  -- out/evalalpha --
    46  (struct){
    47    simplified: (struct){
    48      x: (struct){
    49        d: (string){ ".*" }
    50      }
    51      out: (string){ "d: .*\n" }
    52    }
    53    original: (struct){
    54      #testableRegexp: (string){
    55        string
    56        #test: (#struct){
    57          in: (string){ string }
    58          out: (_|_){
    59            // [incomplete] original.#testableRegexp.#test.out: non-concrete value string in operand to +:
    60            //     ./in.cue:20:29
    61            //     ./in.cue:16:3
    62          }
    63        }
    64      }
    65      rule: (struct){
    66        #patterns: (#struct){
    67          bar: (string){
    68            "(.*)"
    69            #test: (#struct){
    70              in: (string){ "testcontent" }
    71              out: (string){ "testcontent" }
    72            }
    73          }
    74        }
    75      }
    76      out: (string){ "{}\n" }
    77    }
    78  }
    79  -- diff/-out/evalalpha<==>+out/eval --
    80  diff old new
    81  --- old
    82  +++ new
    83  @@ -13,7 +13,6 @@
    84           out: (_|_){
    85             // [incomplete] original.#testableRegexp.#test.out: non-concrete value string in operand to +:
    86             //     ./in.cue:20:29
    87  -          //     ./in.cue:15:21
    88             //     ./in.cue:16:3
    89           }
    90         }
    91  -- diff/todo/p2 --
    92  Missing error position.
    93  -- out/eval --
    94  (struct){
    95    simplified: (struct){
    96      x: (struct){
    97        d: (string){ ".*" }
    98      }
    99      out: (string){ "d: .*\n" }
   100    }
   101    original: (struct){
   102      #testableRegexp: (string){
   103        string
   104        #test: (#struct){
   105          in: (string){ string }
   106          out: (_|_){
   107            // [incomplete] original.#testableRegexp.#test.out: non-concrete value string in operand to +:
   108            //     ./in.cue:20:29
   109            //     ./in.cue:15:21
   110            //     ./in.cue:16:3
   111          }
   112        }
   113      }
   114      rule: (struct){
   115        #patterns: (#struct){
   116          bar: (string){
   117            "(.*)"
   118            #test: (#struct){
   119              in: (string){ "testcontent" }
   120              out: (string){ "testcontent" }
   121            }
   122          }
   123        }
   124      }
   125      out: (string){ "{}\n" }
   126    }
   127  }
   128  -- out/compile --
   129  --- in.cue
   130  {
   131    simplified: {
   132      x: {
   133        d: {
   134          ".*"
   135          [
   136            (〈2〉 + ""),
   137          ][0]
   138        }
   139      }
   140      out: 〈import;"encoding/yaml"〉.Marshal(〈0;x〉)
   141    }
   142    original: {
   143      #testableRegexp: {
   144        string
   145        #test: close({
   146          in: string
   147          out: 〈import;regexp〉.FindSubmatch((("^" + 〈2〉) + "$"), 〈0;in〉)[1]
   148        })
   149      }
   150      rule: {
   151        #patterns: {
   152          bar: (〈2;#testableRegexp〉 & {
   153            "(.*)"
   154            #test: {
   155              in: "testcontent"
   156              out: "testcontent"
   157            }
   158          })
   159        }
   160      }
   161      out: 〈import;"encoding/yaml"〉.Marshal(〈0;rule〉)
   162    }
   163  }