Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/LexerRules/OrderedListRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
13 changes: 13 additions & 0 deletions tests/TokenCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
Loading