mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 04:58:15 +01:00
Add parsing tests
This commit is contained in:
parent
a6e7eca23a
commit
840469a24f
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Cerbero\JsonParser\Dataset;
|
||||
use Cerbero\JsonParser\Decoders\SimdjsonDecoder;
|
||||
use Cerbero\JsonParser\JsonParser;
|
||||
|
||||
use function Cerbero\JsonParser\parseJson;
|
||||
@ -18,6 +19,14 @@ it('parses JSON when calling the helper', function (string $json, array $parsed)
|
||||
expect(parseJson($json))->toParseTo($parsed);
|
||||
})->with(Dataset::forParsing());
|
||||
|
||||
it('parses with custom decoders', function (string $json, array $parsed) {
|
||||
expect(JsonParser::parse($json)->decoder(new SimdjsonDecoder()))->toParseTo($parsed);
|
||||
})->with(Dataset::forParsing());
|
||||
|
||||
it('parses a custom number of bytes', function (string $json, array $parsed) {
|
||||
expect(JsonParser::parse($json)->bytes(1024))->toParseTo($parsed);
|
||||
})->with(Dataset::forParsing());
|
||||
|
||||
it('eager loads JSON into an array', function (string $json, array $parsed) {
|
||||
expect(JsonParser::parse($json)->toArray())->toBe($parsed);
|
||||
})->with(Dataset::forParsing());
|
||||
|
Loading…
x
Reference in New Issue
Block a user