mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 13:08:16 +01:00
Test that indexes are preserved
This commit is contained in:
parent
45ed8e9650
commit
b09b738173
60
tests/fixtures/pointers/multiple_pointers.php
vendored
60
tests/fixtures/pointers/multiple_pointers.php
vendored
@ -14,34 +14,38 @@ return [
|
||||
],
|
||||
'/-/batters/batter/-,/-/name' => [
|
||||
'name' => ['Cake', 'Raised', 'Old Fashioned'],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
0 => [
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
],
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
1 => [
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
],
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
],
|
||||
],
|
||||
[
|
||||
2 => [
|
||||
"id" => "1003",
|
||||
"type" => "Blueberry",
|
||||
],
|
||||
[
|
||||
3 => [
|
||||
"id" => "1004",
|
||||
"type" => "Devil's Food",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
],
|
||||
],
|
||||
],
|
||||
'complex_object' => [
|
||||
@ -85,14 +89,14 @@ return [
|
||||
],
|
||||
'simple_array' => [
|
||||
'/-1,/-2' => [],
|
||||
'/0,/1' => [1, ''],
|
||||
'/1,/0' => [1, ''],
|
||||
'/0,/2' => [1, 'foo'],
|
||||
'/2,/3' => ['foo', '"bar"'],
|
||||
'/3,/4,/5' => ['"bar"', 'hej då', 3.14],
|
||||
'/4,/5,/3' => ['"bar"', 'hej då', 3.14],
|
||||
'/6,/7,/8,/9' => [false, null, [], []],
|
||||
'/9,/8,/7,/6' => [false, null, [], []],
|
||||
'/0,/1' => [0 => 1, 1 => ''],
|
||||
'/1,/0' => [0 => 1, 1 => ''],
|
||||
'/0,/2' => [0 => 1, 2 => 'foo'],
|
||||
'/2,/3' => [2 => 'foo', 3 => '"bar"'],
|
||||
'/3,/4,/5' => [3 => '"bar"', 4 => 'hej då', 5 => 3.14],
|
||||
'/4,/5,/3' => [3 => '"bar"', 4 => 'hej då', 5 => 3.14],
|
||||
'/6,/7,/8,/9' => [6 => false, 7 => null, 8 => [], 9 => []],
|
||||
'/9,/8,/7,/6' => [6 => false, 7 => null, 8 => [], 9 => []],
|
||||
],
|
||||
'simple_object' => [
|
||||
'/-1,/-2' => [],
|
||||
|
64
tests/fixtures/pointers/single_pointer.php
vendored
64
tests/fixtures/pointers/single_pointer.php
vendored
@ -88,34 +88,38 @@ return [
|
||||
],
|
||||
],
|
||||
'/-/batters/batter/-' => [
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
0 => [
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
],
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
1 => [
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
],
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
],
|
||||
],
|
||||
[
|
||||
2 => [
|
||||
"id" => "1003",
|
||||
"type" => "Blueberry",
|
||||
],
|
||||
[
|
||||
3 => [
|
||||
"id" => "1004",
|
||||
"type" => "Devil's Food",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1001",
|
||||
"type" => "Regular",
|
||||
],
|
||||
[
|
||||
"id" => "1002",
|
||||
"type" => "Chocolate",
|
||||
],
|
||||
],
|
||||
'/-/batters/batter/-/id' => ['id' => ["1001", "1002", "1003", "1004", "1001", "1001", "1002"]],
|
||||
],
|
||||
@ -203,16 +207,16 @@ return [
|
||||
'' => $simpleArray = require __DIR__ . '/../parsing/simple_array.php',
|
||||
'/-' => $simpleArray,
|
||||
'/-1' => [],
|
||||
'/0' => [1],
|
||||
'/1' => [''],
|
||||
'/2' => ['foo'],
|
||||
'/3' => ['"bar"'],
|
||||
'/4' => ['hej då'],
|
||||
'/5' => [3.14],
|
||||
'/6' => [false],
|
||||
'/7' => [null],
|
||||
'/8' => [[]],
|
||||
'/9' => [[]],
|
||||
'/0' => [0 => 1],
|
||||
'/1' => [1 => ''],
|
||||
'/2' => [2 => 'foo'],
|
||||
'/3' => [3 => '"bar"'],
|
||||
'/4' => [4 => 'hej då'],
|
||||
'/5' => [5 => 3.14],
|
||||
'/6' => [6 => false],
|
||||
'/7' => [7 => null],
|
||||
'/8' => [8 => []],
|
||||
'/9' => [9 => []],
|
||||
'/10' => [],
|
||||
'/foo' => [],
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user