this repo has no description
0
fork

Configure Feed

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

cue: add more entries to the fuzzing seed corpus

* numeric literals with exponents
* string labels with spaces
* complex built-ins like matchN
* recursive declarations
* octal escape sequences
* multi-line string and bytes literals
* indices and selectors

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Ie7b528ba42fde0cb7425e64d6cfa189ed0893eed
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1235172
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Matthew Sackman <matthew@cue.works>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+19 -4
+19 -4
cue/fuzz_test.go
··· 38 38 // group // here 39 39 `) 40 40 f.Add(`"some string"`) 41 - f.Add(`[1, 2.3, 4M, 5Gi]`) 41 + f.Add(`[1, 2.3, 4M, 5Gi, 1E6, 1.e+0, .23E-10]`) 42 42 f.Add(`if foo { if bar if baz { x } }`) 43 43 f.Add(`[x for x in [a, b, c]]`) 44 - f.Add(`foo: "bar": (baz): "\(x)": y`) 44 + f.Add(`foo: "bar ": (baz): "\(x)": y`) 45 45 f.Add(`{x: _, y: _|_}`) 46 46 f.Add(`3 & int32`) 47 47 f.Add(`string | *"foo"`) ··· 50 50 f.Add(`[1>1, 2>=2, 3==3, 4!=4]`) 51 51 f.Add(`[=~"^a"]: bool`) 52 52 f.Add(`[X=string]: Y={}`) 53 - f.Add(`[len(x), close(y), and([]), or([]), div(5, 2)]`) 53 + f.Add(`[len(x), close({y}), and([]), or([]), div(5, 2)]`) 54 + f.Add(`value: "foo" & matchN(2, [string, !="bar", <4])`) 55 + f.Add(`a: b: a`) 54 56 f.Add(`[null, bool, float, bytes, int16, uint128]`) 55 57 f.Add(`[ [...string], {x: string, ...}]]`) 56 58 f.Add(`{regular: x, required!: x, optional?: x}`) 57 59 f.Add(`{_hidden: x, #Definition: x, αβ: x}`) 58 - f.Add(`["\u65e5本\U00008a9e", '\xff\u00FF']`) 60 + f.Add(`["\u65e5本\U00008a9e", '\xff\003']`) 61 + f.Add(`""" 62 + here is a multiline 63 + string literal 64 + """`) 65 + f.Add(`''' 66 + here is a multiline 67 + bytes literal 68 + '''`) 59 69 f.Add(`["\(expr)", #"\#(expr) \(notexpr)"#]`) 70 + f.Add(`##""" 71 + \(these are not 72 + #\(interpolations 73 + """##`) 60 74 f.Add(`{@jsonschema(id="foo"), field: string @go(Field,type=Other)}`) 61 75 f.Add(`@experiment(explicitopen), out: #Schema... & data`) 62 76 f.Add(`@experiment(aliasv2), "-foo"~A: 42`) 63 77 f.Add(`@experiment(try), a?: int, try { b: a? + 1 }`) 64 78 f.Add(`@experiment(try), if false { "yes" } else { "no" }`) 65 79 f.Add(`@experiment(try), for x in [] { x } fallback { "zero" }`) 80 + f.Add(`a[0], b["foo"], #c.#bar, _d._baz`) 66 81 f.Fuzz(func(t *testing.T, s string) { 67 82 if len(s) > 100 { 68 83 t.Skip() // keep inputs reasonably small for now