decode($json)) ->toBeInstanceOf(DecodedValue::class) ->succeeded->toBeTrue() ->value->toEqual($value) ->error->toBeNull() ->code->toBeNull() ->exception->toBeNull(); expect($decoded->json)->toBeNull(); })->with(Dataset::forDecoders()); it('reports issues when a JSON is not valid', function () { $json = '[1a]'; $e = new SimdJsonException('Problem while parsing a number', 9); expect($decoded = (new SimdjsonDecoder())->decode($json)) ->toBeInstanceOf(DecodedValue::class) ->succeeded->toBeFalse() ->value->toBeNull() ->error->toBe($e->getMessage()) ->code->toBe($e->getCode()) ->exception->toEqual($e); expect($decoded->json)->toBe($json); });