...

Text file src/cuelang.org/go/cue/testdata/resolve/013_custom_validators.txtar

Documentation: cuelang.org/go/cue/testdata/resolve

     1# DO NOT EDIT; generated by go run testdata/gen.go
     2#
     3#name: custom validators
     4#evalPartial
     5-- in.cue --
     6import "strings"
     7
     8a: strings.ContainsAny("ab")
     9a: "after"
    10
    11b: strings.ContainsAny("c")
    12b: "dog"
    13
    14c: strings.ContainsAny("d") & strings.ContainsAny("g")
    15c: "dog"
    16-- out/def --
    17a: "after"
    18b: _|_ // invalid value "dog" (does not satisfy strings.ContainsAny("c"))
    19c: "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 --
    23Leaks:  0
    24Freed:  4
    25Reused: 2
    26Allocs: 2
    27Retain: 0
    28
    29Unifications: 4
    30Conjuncts:    8
    31Disjuncts:    4
    32-- out/eval --
    33Errors:
    34b: 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
    39Result:
    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}

View as plain text