| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: custom validators |
| #evalPartial |
| -- in.cue -- |
| import "strings" |
| |
| a: strings.ContainsAny("ab") |
| a: "after" |
| |
| b: strings.ContainsAny("c") |
| b: "dog" |
| |
| c: strings.ContainsAny("d") & strings.ContainsAny("g") |
| c: "dog" |
| -- out/def -- |
| a: "after" |
| b: _|_ // invalid value "dog" (does not satisfy strings.ContainsAny("c")) |
| c: "dog" |
| -- out/legacy-debug -- |
| <0>{a: "after", b: _|_(strings.ContainsAny ("c"):invalid value "dog" (does not satisfy strings.ContainsAny("c"))), c: "dog"} |
| -- out/eval -- |
| Errors: |
| b: invalid value "dog" (does not satisfy strings.ContainsAny("c")): |
| ./in.cue:6:4 |
| ./in.cue:6:24 |
| ./in.cue:7:4 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| a: (string){ "after" } |
| b: (_|_){ |
| // [eval] b: invalid value "dog" (does not satisfy strings.ContainsAny("c")): |
| // ./in.cue:6:4 |
| // ./in.cue:6:24 |
| // ./in.cue:7:4 |
| } |
| c: (string){ "dog" } |
| } |
| -- out/compile -- |
| --- in.cue |
| { |
| a: 〈import;strings〉.ContainsAny("ab") |
| a: "after" |
| b: 〈import;strings〉.ContainsAny("c") |
| b: "dog" |
| c: (〈import;strings〉.ContainsAny("d") & 〈import;strings〉.ContainsAny("g")) |
| c: "dog" |
| } |