diff --git a/packages/guides-restructured-text/src/RestructuredText/Parser/InlineLexer.php b/packages/guides-restructured-text/src/RestructuredText/Parser/InlineLexer.php index bebdfa445..94aaf19ba 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Parser/InlineLexer.php +++ b/packages/guides-restructured-text/src/RestructuredText/Parser/InlineLexer.php @@ -74,7 +74,7 @@ protected function getCatchablePatterns(): array '|', '\\*\\*', '\\*', - '\b(?setInput($input); + $lexer->moveNext(); + + for ($i = 0; $i < 21; $i++) { + $lexer->moveNext(); + assertEquals( + trim($input[$i]) === '' ? InlineLexer::WHITESPACE : InlineLexer::WORD, + $lexer->token?->type, + ); + assertEquals($input[$i], $lexer->token?->value); + } + + $lexer->moveNext(); + assertEquals(InlineLexer::HYPERLINK, $lexer->token?->type); + assertEquals($url, $lexer->token?->value); + } + + /** @return array> */ + public static function hyperlinkProvider(): array + { + return [ + 'Url with parenthesis' => ['https://www.test.com'], + 'Url with parenthesis and query' => ['https://www.test.com?query=1'], + 'Url with parenthesis and query and fragment' => ['https://www.test.com?query=1#fragment'], + ]; + } }