X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Ftest%2FPsy%2FTest%2FCodeCleaner%2FExitPassTest.php;fp=vendor%2Fpsy%2Fpsysh%2Ftest%2FPsy%2FTest%2FCodeCleaner%2FExitPassTest.php;h=43b55546b987fcb72f34d0e00bdf30118581c645;hp=0000000000000000000000000000000000000000;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php new file mode 100644 index 000000000..43b55546b --- /dev/null +++ b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php @@ -0,0 +1,59 @@ +setPass(new ExitPass()); + } + + /** + * @dataProvider dataProviderExitStatement + */ + public function testExitStatement($from, $to) + { + $this->assertProcessesAs($from, $to); + } + + /** + * Data provider for testExitStatement. + * + * @return array + */ + public function dataProviderExitStatement() + { + return array( + array('exit;', "{$this->expectedExceptionString};"), + array('exit();', "{$this->expectedExceptionString};"), + array('die;', "{$this->expectedExceptionString};"), + array('exit(die(die));', "{$this->expectedExceptionString};"), + array('if (true) { exit; }', "if (true) {\n {$this->expectedExceptionString};\n}"), + array('if (false) { exit; }', "if (false) {\n {$this->expectedExceptionString};\n}"), + array('1 and exit();', "1 and {$this->expectedExceptionString};"), + array('foo() or die', "foo() or {$this->expectedExceptionString};"), + array('exit and 1;', "{$this->expectedExceptionString} and 1;"), + array('if (exit) { echo $wat; }', "if ({$this->expectedExceptionString}) {\n echo \$wat;\n}"), + array('exit or die;', "{$this->expectedExceptionString} or {$this->expectedExceptionString};"), + array('switch (die) { }', "switch ({$this->expectedExceptionString}) {\n}"), + array('for ($i = 1; $i < 10; die) {}', "for (\$i = 1; \$i < 10; {$this->expectedExceptionString}) {\n}"), + ); + } +}