cuelang.org/go@v0.10.1/cue/testdata/basicrewrite/007_strings_and_bytes.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: strings and bytes
     4  #evalPartial
     5  -- in.cue --
     6  s0: "foo" + "bar"
     7  s1: 3 * "abc"
     8  s2: "abc" * 2
     9  
    10  b0: 'foo' + 'bar'
    11  b1: 3 * 'abc'
    12  b2: 'abc' * 2
    13  
    14  // TODO: consider the semantics of this and perhaps allow this.
    15  e0: "a" + ''
    16  e1: 'b' + "c"
    17  -- out/def --
    18  s0: "foobar"
    19  s1: "abcabcabc"
    20  s2: "abcabc"
    21  b0: 'foobar'
    22  b1: 'abcabcabc'
    23  b2: 'abcabc'
    24  
    25  // TODO: consider the semantics of this and perhaps allow this.
    26  e0: _|_ // invalid operation "a" + '' (mismatched types string and bytes)
    27  e1: _|_ // invalid operation 'b' + "c" (mismatched types bytes and string)
    28  -- out/legacy-debug --
    29  <0>{s0: "foobar", s1: "abcabcabc", s2: "abcabc", b0: 'foobar', b1: 'abcabcabc', b2: 'abcabc', e0: _|_(("a" + ''):invalid operation "a" + '' (mismatched types string and bytes)), e1: _|_(('b' + "c"):invalid operation 'b' + "c" (mismatched types bytes and string))}
    30  -- out/compile --
    31  --- in.cue
    32  {
    33    s0: ("foo" + "bar")
    34    s1: (3 * "abc")
    35    s2: ("abc" * 2)
    36    b0: ('foo' + 'bar')
    37    b1: (3 * 'abc')
    38    b2: ('abc' * 2)
    39    e0: ("a" + '')
    40    e1: ('b' + "c")
    41  }
    42  -- out/eval/stats --
    43  Leaks:  0
    44  Freed:  9
    45  Reused: 7
    46  Allocs: 2
    47  Retain: 0
    48  
    49  Unifications: 9
    50  Conjuncts:    9
    51  Disjuncts:    9
    52  -- out/eval --
    53  Errors:
    54  e0: invalid operands "a" and '' to '+' (type string and bytes):
    55      ./in.cue:10:5
    56      ./in.cue:10:11
    57  e1: invalid operands 'b' and "c" to '+' (type bytes and string):
    58      ./in.cue:11:5
    59      ./in.cue:11:11
    60  
    61  Result:
    62  (_|_){
    63    // [eval]
    64    s0: (string){ "foobar" }
    65    s1: (string){ "abcabcabc" }
    66    s2: (string){ "abcabc" }
    67    b0: (bytes){ 'foobar' }
    68    b1: (bytes){ 'abcabcabc' }
    69    b2: (bytes){ 'abcabc' }
    70    e0: (_|_){
    71      // [eval] e0: invalid operands "a" and '' to '+' (type string and bytes):
    72      //     ./in.cue:10:5
    73      //     ./in.cue:10:11
    74    }
    75    e1: (_|_){
    76      // [eval] e1: invalid operands 'b' and "c" to '+' (type bytes and string):
    77      //     ./in.cue:11:5
    78      //     ./in.cue:11:11
    79    }
    80  }