Skip to content

Commit 1199c03

Browse files
committed
Add test to verify key omission rules
1 parent 6d8cfcd commit 1199c03

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/tests/ArrayEncodingTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@ public function testInlineArray()
2222
$this->assertEncode("[7, 8, 8, 9]", [7, 8, 8, 9], $encoder);
2323
}
2424

25+
public function testOmittedKeySkips()
26+
{
27+
$this->assertEncode(
28+
$this->format(
29+
<<<'RESULT'
30+
[
31+
1 => 1,
32+
2,
33+
10 => 10,
34+
3 => 3,
35+
4 => 4,
36+
11,
37+
12,
38+
13,
39+
15 => 15,
40+
]
41+
RESULT
42+
),
43+
[1 => 1, 2 => 2, 10 => 10, 3 => 3, 4 => 4, 11 => 11, 12 => 12, 13 => 13, 15 => 15],
44+
new PHPEncoder()
45+
);
46+
}
47+
2548
public function testInlineWithMultiLineString()
2649
{
2750
$this->assertEncode(

0 commit comments

Comments
 (0)