cuelang.org/go@v0.10.1/cue/testdata/resolve/013_custom_validators.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: custom validators
     4  #evalPartial
     5  -- in.cue --
     6  import "strings"
     7  
     8  a: strings.ContainsAny("ab")
     9  a: "after"
    10  
    11  b: strings.ContainsAny("c")
    12  b: "dog"
    13  
    14  c: strings.ContainsAny("d") & strings.ContainsAny("g")
    15  c: "dog"
    16  -- out/def --
    17  a: "after"
    18  b: _|_ // invalid value "dog" (does not satisfy strings.ContainsAny("c"))
    19  c: "dog"
    20  -- out/legacy-debug --
    21  <0>{a: "after", b: _|_(strings.ContainsAny ("c"):invalid value "dog" (does not satisfy strings.ContainsAny("c"))), c: "dog"}
    22  -- out/eval/stats --
    23  Leaks:  0
    24  Freed:  4
    25  Reused: 2
    26  Allocs: 2
    27  Retain: 0
    28  
    29  Unifications: 4
    30  Conjuncts:    8
    31  Disjuncts:    4
    32  -- out/eval --
    33  Errors:
    34  b: invalid value "dog" (does not satisfy strings.ContainsAny("c")):
    35      ./in.cue:6:4
    36      ./in.cue:6:24
    37      ./in.cue:7:4
    38  
    39  Result:
    40  (_|_){
    41    // [eval]
    42    a: (string){ "after" }
    43    b: (_|_){
    44      // [eval] b: invalid value "dog" (does not satisfy strings.ContainsAny("c")):
    45      //     ./in.cue:6:4
    46      //     ./in.cue:6:24
    47      //     ./in.cue:7:4
    48    }
    49    c: (string){ "dog" }
    50  }
    51  -- out/compile --
    52  --- in.cue
    53  {
    54    a: 〈import;strings〉.ContainsAny("ab")
    55    a: "after"
    56    b: 〈import;strings〉.ContainsAny("c")
    57    b: "dog"
    58    c: (〈import;strings〉.ContainsAny("d") & 〈import;strings〉.ContainsAny("g"))
    59    c: "dog"
    60  }