Skip to content

Commit

Permalink
@prints can match a single char
Browse files Browse the repository at this point in the history
  • Loading branch information
mathroc committed Jul 17, 2022
1 parent 97a81f7 commit 7d56638
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Subscriber/TestExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private static function expectedOutput(string $code): string
$expectedOutput = [];

foreach (\explode(PHP_EOL, $code) as $line) {
\preg_match("/\/\/\s*@prints\s*(?<text>[^\s].*[^\s])\s*$/", $line, $matches);
\preg_match("/\/\/\s*@prints\s*(?<text>[^\s].*)$/", $line, $matches);

if (\array_key_exists("text", $matches)) {
$expectedOutput[] = $matches["text"];
Expand Down
3 changes: 3 additions & 0 deletions tests/data/examples/output/single-char.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

echo 'a'; // @prints a
3 changes: 3 additions & 0 deletions tests/data/examples/output/trailing-spaces-are-ignored.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

echo 'a '; // @prints a

0 comments on commit 7d56638

Please sign in to comment.