this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue: add a regression test for issue 2704

Trying to export or vet the cue and json files together, where the first
contained a schema with a disjunction and a regular expression,
results in an incorrect error with the old evaluator.

Thankfully, the new evaluator already handles this correctly.
Add a regression test to ensure that this edge case remains fixed.

Note that I was unable to reproduce this bug with cmd/cue
with the old evaluator using a single CUE file, so it was hard
to add this reproducer as a unit test case elsewhere.

Closes #2704.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I13e4180dba7486909a50fa0fe1300ac05b183ca0
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194741
Reviewed-by: Paul Jolly <paul@myitcv.io>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+29
+29
cmd/cue/cmd/testdata/script/vet_issue2704.txtar
··· 1 + # https://cuelang.org/issues/2704 2 + 3 + ! exec cue export schema.cue data.json 4 + cmp stderr evalv2-stderr.golden 5 + ! exec cue vet schema.cue data.json 6 + cmp stderr evalv2-stderr.golden 7 + 8 + # This issue is already fixed in the new evaluator. 9 + env CUE_EXPERIMENT=evalv3 10 + 11 + exec cue export schema.cue data.json 12 + cmp stdout evalv3-stdout.golden 13 + exec cue vet schema.cue data.json 14 + ! stdout . 15 + 16 + -- evalv2-stderr.golden -- 17 + 1: invalid value "value" (out of bound =~"^[0-9]+$"): 18 + ./schema.cue:1:14 19 + ./data.json:1:7 20 + -- evalv3-stdout.golden -- 21 + [ 22 + "5", 23 + "value" 24 + ] 25 + -- schema.cue -- 26 + #schema: [...=~"^[0-9]+$" | string] 27 + #schema 28 + -- data.json -- 29 + ["5", "value"]