cuelang.org/go@v0.13.0/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:  17
    38  Reused: 10
    39  Allocs: 11
    40  Retain: 4
    41  
    42  Unifications: 21
    43  Conjuncts:    39
    44  Disjuncts:    21
    45  -- out/eval --
    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:15:21
    62            //     ./in.cue:16:3
    63          }
    64        }
    65      }
    66      rule: (struct){
    67        #patterns: (#struct){
    68          bar: (string){
    69            "(.*)"
    70            #test: (#struct){
    71              in: (string){ "testcontent" }
    72              out: (string){ "testcontent" }
    73            }
    74          }
    75        }
    76      }
    77      out: (string){ "{}\n" }
    78    }
    79  }
    80  -- out/compile --
    81  --- in.cue
    82  {
    83    simplified: {
    84      x: {
    85        d: {
    86          ".*"
    87          [
    88            (〈2〉 + ""),
    89          ][0]
    90        }
    91      }
    92      out: 〈import;"encoding/yaml"〉.Marshal(〈0;x〉)
    93    }
    94    original: {
    95      #testableRegexp: {
    96        string
    97        #test: close({
    98          in: string
    99          out: 〈import;regexp〉.FindSubmatch((("^" + 〈2〉) + "$"), 〈0;in〉)[1]
   100        })
   101      }
   102      rule: {
   103        #patterns: {
   104          bar: (〈2;#testableRegexp〉 & {
   105            "(.*)"
   106            #test: {
   107              in: "testcontent"
   108              out: "testcontent"
   109            }
   110          })
   111        }
   112      }
   113      out: 〈import;"encoding/yaml"〉.Marshal(〈0;rule〉)
   114    }
   115  }