Skip to content

Commit 5d863b6

Browse files
committed
pkg/encoding/json: add tests for issue 3932
Issue #3932 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I4897cd71b4959a760ebb02eb5447259af6ba59e9 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1215527 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent af81550 commit 5d863b6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pkg/encoding/json/testdata/gen.txtar

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ validate: enforceRequired: {
2020
schema: {x!: int}
2121
}
2222

23+
issue3932: {
24+
f: json.Validate({name!: string})
25+
f: json.Marshal({name: "foo"})
26+
}
27+
2328
valid: [string]: {
2429
string // input
2530
#result: json.Valid(string)
@@ -96,9 +101,9 @@ validate.t2.result: error in call to encoding/json.Validate: invalid value 10 (o
96101
./in.cue:9:27
97102
json.Validate:1:6
98103
unmarshal.trailingInvalid.#result: error in call to encoding/json.Unmarshal: json: invalid JSON:
99-
./in.cue:42:11
104+
./in.cue:47:11
100105
unmarshal.trailingValid.#result: error in call to encoding/json.Unmarshal: json: invalid JSON:
101-
./in.cue:42:11
106+
./in.cue:47:11
102107

103108
Result:
104109
import "encoding/json"
@@ -146,6 +151,13 @@ validate: {
146151
result: json.Validate(str, schema)
147152
}
148153
}
154+
issue3932: {
155+
f: json.Validate({
156+
name!: string
157+
}) & json.Marshal({
158+
name: "foo"
159+
})
160+
}
149161
valid: {
150162
t1: {
151163
"1"

0 commit comments

Comments
 (0)