@@ -2340,13 +2340,19 @@ func TestUnifyAccept(t *testing.T) {
2340
2340
want : `"foo"` ,
2341
2341
}, {
2342
2342
value : `#v: {a: "foo"}, #w: {b: 4}, #accept: {a: string, b: int}` ,
2343
- want : `{"a":"foo","b":4}` ,
2343
+ want : `{
2344
+ a: "foo"
2345
+ b: 4
2346
+ }` ,
2344
2347
}, {
2345
2348
value : `#v: [string, 4], #w: ["foo", 4], #accept: [string, int, ...]` ,
2346
- want : `["foo",4]` ,
2349
+ want : `["foo", 4]` ,
2347
2350
}, {
2348
2351
value : `#v: {a: string, b: 1, _#hidden: int}, #w: {a: "foo"}, #accept: {...}` ,
2349
- want : `{"a":"foo","b":1}` ,
2352
+ want : `{
2353
+ a: "foo"
2354
+ b: 1
2355
+ }` ,
2350
2356
}, {
2351
2357
// Issue #2325: let should not result in a closedness error.
2352
2358
value : `#accept: {
@@ -2364,7 +2370,9 @@ func TestUnifyAccept(t *testing.T) {
2364
2370
#w: {b:1}
2365
2371
#accept: {...}
2366
2372
` ,
2367
- want : `{"b":1}` ,
2373
+ want : `{
2374
+ b: 1
2375
+ }` ,
2368
2376
}}
2369
2377
2370
2378
matrix := cuetdtest .FullMatrix
@@ -2375,14 +2383,17 @@ func TestUnifyAccept(t *testing.T) {
2375
2383
matrix .Do (t , func (t * testing.T , m * cuetdtest.M ) {
2376
2384
tdtest .Run (t , testCases , func (t * cuetest.T , tc * testCase ) {
2377
2385
v := getValue (m , tc .value )
2386
+ if err := v .Err (); err != nil {
2387
+ t .Fatal (err )
2388
+ }
2378
2389
x := v .LookupPath (cue .ParsePath ("#v" ))
2379
2390
y := v .LookupPath (cue .ParsePath ("#w" ))
2380
2391
a := v .LookupPath (cue .ParsePath ("#accept" ))
2381
- b , err := x .UnifyAccept (y , a ). MarshalJSON ( )
2382
- if err != nil {
2392
+ z := x .UnifyAccept (y , a )
2393
+ if err := z . Err (); err != nil {
2383
2394
t .Fatal (err )
2384
2395
}
2385
- t .Equal (string ( b ), tc .want )
2396
+ t .Equal (fmt . Sprint ( z ), tc .want )
2386
2397
})
2387
2398
})
2388
2399
}
0 commit comments