-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from assertchris/bugfix/add-ast-check-for-midrule
Added Ast check for midrule
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--TEST-- | ||
Check that midrule works | ||
--FILE-- | ||
<?php | ||
|
||
macro { | ||
·chain( | ||
matched, | ||
·midrule(function($stream) { | ||
$index = $stream->index(); | ||
|
||
if (in_array(strtolower($stream->current()), ["true", "false", "null"])) { | ||
return new \Yay\Error(null, null, $stream->last()); | ||
} | ||
|
||
return new \Yay\Ast; | ||
}), | ||
·ns()·ns | ||
) | ||
} >> { | ||
replaced ·ns | ||
} | ||
|
||
matched true | ||
matched false | ||
matched null | ||
|
||
matched strtoupper | ||
matched ucwords | ||
|
||
?> | ||
--EXPECTF-- | ||
<?php | ||
|
||
matched true | ||
matched false | ||
matched null | ||
|
||
replaced strtoupper | ||
replaced ucwords | ||
|
||
?> |