File tree Expand file tree Collapse file tree
packages/guides-restructured-text/tests/unit/Parser/Productions/InlineRules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,4 +148,31 @@ public function __construct(
148148 */
149149 self ::assertSame ($ expectedRawContent , $ node ->rawContent );
150150 }
151+
152+ public function testApplyReturnsNullOnTrailingBackslashWithoutRaisingWarning (): void
153+ {
154+ $ input = ":role:`text \\" ;
155+
156+ $ textRoleFactory = $ this ->createMock (TextRoleFactory::class);
157+ $ textRoleFactory ->expects (self ::never ())->method ('getTextRole ' );
158+
159+ $ lexer = new InlineLexer ();
160+ $ lexer ->setInput ($ input );
161+ $ lexer ->moveNext ();
162+ $ lexer ->moveNext ();
163+
164+ $ textRoleRule = new TextRoleRule ();
165+ self ::assertTrue ($ textRoleRule ->applies ($ lexer ));
166+
167+ $ documentParserContext = new DocumentParserContext (
168+ self ::createStub (ParserContext::class),
169+ $ textRoleFactory ,
170+ self ::createStub (MarkupLanguageParser::class),
171+ );
172+
173+ self ::assertNull ($ textRoleRule ->apply (
174+ new BlockContext ($ documentParserContext , '' ),
175+ $ lexer ,
176+ ));
177+ }
151178}
You can’t perform that action at this time.
0 commit comments