X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Ftest%2FCodeCleaner%2FFunctionContextPassTest.php;fp=vendor%2Fpsy%2Fpsysh%2Ftest%2FCodeCleaner%2FFunctionContextPassTest.php;h=851eb2284eb3f19e764dfe78b8d0172a8fe5b396;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/psy/psysh/test/CodeCleaner/FunctionContextPassTest.php b/vendor/psy/psysh/test/CodeCleaner/FunctionContextPassTest.php new file mode 100644 index 000000000..851eb2284 --- /dev/null +++ b/vendor/psy/psysh/test/CodeCleaner/FunctionContextPassTest.php @@ -0,0 +1,56 @@ +setPass(new FunctionContextPass()); + } + + /** + * @dataProvider validStatements + */ + public function testProcessStatementPasses($code) + { + $this->parseAndTraverse($code); + $this->assertTrue(true); + } + + public function validStatements() + { + return [ + ['function foo() { yield; }'], + ['if (function(){ yield; })'], + ]; + } + + /** + * @dataProvider invalidYieldStatements + * @expectedException \Psy\Exception\FatalErrorException + */ + public function testInvalidYield($code) + { + $this->parseAndTraverse($code); + } + + public function invalidYieldStatements() + { + return [ + ['yield'], + ['if (yield)'], + ]; + } +}