this repo has no description
0
fork

Configure Feed

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

encoding/jsonschema: add a few tests

This adds a few tests for behavior that's about to change:
- an empty open list that could be encoded without an `items` keyword
- a `null` value that could be encoded with `type` rather than `const`

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I652a6e684f95d6991366eb571030fd4b05942481
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1224281
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+13 -2
+4
encoding/jsonschema/testdata/generate/basic.txtar
··· 7 7 t5?: bool 8 8 t6?: string | int 9 9 t7?: bytes 10 + t8?: null 10 11 -- datatest/tests.cue -- 11 12 package datatest 12 13 ··· 47 48 }] 48 49 } 49 50 t7: true 51 + t8: { 52 + const: null 53 + } 50 54 } 51 55 } 52 56 -- out/generate-v3/ok --
+9 -2
encoding/jsonschema/testdata/generate/lists.txtar
··· 16 16 // Empty list 17 17 emptyList?: [] 18 18 19 + // Empty open list 20 + emptyOpenList?: [...] 21 + 19 22 -- datatest/tests.cue -- 20 23 package datatest 21 24 ··· 52 55 type: "array" 53 56 maxLength: 0 54 57 } 58 + emptyOpenList: { 59 + type: "array" 60 + items: true 61 + } 55 62 mixedTuple: { 56 63 type: "array" 57 64 prefixItems: [{ ··· 97 104 ./datatest/tests.cue:14:27 98 105 -- out/generate-v3/badTupleLength -- 99 106 badTupleLength.data.tuple: incompatible list lengths (1 and 3): 100 - 1:391 107 + 1:437 101 108 -- out/generate-v3/badTupleType -- 102 109 badTupleType.data.tuple.0: conflicting values 1 and string (mismatched types int and string): 103 110 ./datatest/tests.cue:24:16 104 111 badTupleType.data.tuple.1: conflicting values "bar" and int (mismatched types string and int): 105 - 1:425 112 + 1:471 106 113 ./datatest/tests.cue:24:19 107 114 -- out/generate-v3/ok1 -- 108 115 -- out/generate-v3/ok2 --