cuelang.org/go@v0.10.1/pkg/strings/testdata/gen.txtar (about)

     1  # generated from the original tests.
     2  # Henceforth it may be nicer to group tests into separate files.
     3  -- in.cue --
     4  import "strings"
     5  
     6  t1:  strings.Join(["Hello", "World!"], " ")
     7  t2:  strings.Join([1, 2], " ")
     8  t3:  strings.ByteAt("a", 0)
     9  t4:  strings.ByteSlice("Hello", 2, 5)
    10  t5:  strings.SliceRunes("✓ Hello", 0, 3)
    11  t6:  strings.Runes("Café")
    12  t7:  strings.ToCamel("AlphaBeta")
    13  t8:  strings.ToTitle("alpha")
    14  t9:  strings.MaxRunes(3) & "foo"
    15  t10: strings.MaxRunes(3) & "quux"
    16  t11: strings.MinRunes(1) & "e"
    17  t12: strings.MaxRunes(0) & "e"
    18  t13: strings.MaxRunes(0) & ""
    19  t14: strings.MinRunes(3) & "hello"
    20  t15: strings.MaxRunes(10) & "hello"
    21  t16: strings.MaxRunes(3) & "hello"
    22  t17: strings.MinRunes(10) & "hello"
    23  -- out/strings --
    24  Errors:
    25  t2: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string:
    26      ./in.cue:4:6
    27      ./in.cue:4:20
    28  t10: invalid value "quux" (does not satisfy strings.MaxRunes(3)):
    29      ./in.cue:12:6
    30      ./in.cue:12:23
    31      ./in.cue:12:28
    32  t12: invalid value "e" (does not satisfy strings.MaxRunes(0)):
    33      ./in.cue:14:6
    34      ./in.cue:14:23
    35      ./in.cue:14:28
    36  t16: invalid value "hello" (does not satisfy strings.MaxRunes(3)):
    37      ./in.cue:18:6
    38      ./in.cue:18:23
    39      ./in.cue:18:28
    40  t17: invalid value "hello" (does not satisfy strings.MinRunes(10)):
    41      ./in.cue:19:6
    42      ./in.cue:19:23
    43      ./in.cue:19:29
    44  
    45  Result:
    46  t1: "Hello World!"
    47  t2: _|_ // t2: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string
    48  t3: 97
    49  t4: 'llo'
    50  t5: "✓ H"
    51  t6: [67, 97, 102, 233]
    52  t7:  "alphaBeta"
    53  t8:  "Alpha"
    54  t9:  "foo"
    55  t10: _|_ // t10: invalid value "quux" (does not satisfy strings.MaxRunes(3))
    56  t11: "e"
    57  t12: _|_ // t12: invalid value "e" (does not satisfy strings.MaxRunes(0))
    58  t13: ""
    59  t14: "hello"
    60  t15: "hello"
    61  t16: _|_ // t16: invalid value "hello" (does not satisfy strings.MaxRunes(3))
    62  t17: _|_ // t17: invalid value "hello" (does not satisfy strings.MinRunes(10))