From 57fd5566d26ccdef8a34a546b070f84401cf0cc4 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 19 May 2026 14:21:55 +0200 Subject: [PATCH] Add failing tests --- tests/LexerRules/OrderedListRuleTest.php | 8 ++++++++ tests/TokenCollectionTest.php | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/tests/LexerRules/OrderedListRuleTest.php b/tests/LexerRules/OrderedListRuleTest.php index a396c3c..be6069a 100644 --- a/tests/LexerRules/OrderedListRuleTest.php +++ b/tests/LexerRules/OrderedListRuleTest.php @@ -45,6 +45,14 @@ public function test_numeric_text_without_marker_is_not_an_ordered_list(): void $this->assertEquals(new TextToken('2026 is year'), $tokens[0]); } + #[Test] + public function test_ordered_list_marker_requires_whitespace_after_period(): void + { + $tokens = new Lexer([new OrderedListRule(), new TextRule()])->lex('1.not list'); + + $this->assertEquals(new TextToken('1.not list'), $tokens[0]); + } + #[Test] public function test_lex_nested(): void { diff --git a/tests/TokenCollectionTest.php b/tests/TokenCollectionTest.php index 49a0cc7..38a6dab 100644 --- a/tests/TokenCollectionTest.php +++ b/tests/TokenCollectionTest.php @@ -19,4 +19,17 @@ public function test_array_access_append_uses_next_numeric_index(): void $this->assertSame($token, $collection[0]); } + + #[Test] + public function test_array_access_can_set_explicit_zero_offset_after_append(): void + { + $collection = new TokenCollection(); + $original = new TextToken('x'); + $replacement = new TextToken('y'); + + $collection[] = $original; + $collection[0] = $replacement; + + $this->assertSame($replacement, $collection[0]); + } }