From a73aa7eec1800287e4656f0868deab3bef60e90a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 20 Feb 2016 18:55:48 +0100 Subject: [PATCH] Pretty printer test coverage Our output for yield / yield from is currently not very nice, but also not easy to change. --- test/code/prettyPrinter/expr/intrinsics.test | 29 ++++++++++++ test/code/prettyPrinter/expr/literals.test | 11 +++++ test/code/prettyPrinter/expr/yield.test | 44 +++++++++++++++++++ test/code/prettyPrinter/onlyPHP.file-test | 7 ++- test/code/prettyPrinter/stmt/class.test | 17 ++++++- test/code/prettyPrinter/stmt/const.test | 11 +++++ .../stmt/global_static_variables.test | 11 +++++ 7 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 test/code/prettyPrinter/expr/intrinsics.test create mode 100644 test/code/prettyPrinter/expr/yield.test create mode 100644 test/code/prettyPrinter/stmt/const.test create mode 100644 test/code/prettyPrinter/stmt/global_static_variables.test diff --git a/test/code/prettyPrinter/expr/intrinsics.test b/test/code/prettyPrinter/expr/intrinsics.test new file mode 100644 index 0000000..28adaec --- /dev/null +++ b/test/code/prettyPrinter/expr/intrinsics.test @@ -0,0 +1,29 @@ +isset, empty, unset, exit, die, clone, eval +----- + $b; + $a = yield; + $a = (yield $b); + $a = (yield $b => $c); +} +// TODO Get rid of parens for cases 2 and 3 +----- +function gen() +{ + yield; + (yield $a); + (yield $a => $b); + $a = yield; + $a = (yield $b); + $a = (yield $b => $c); +} +----- + $c; + yield from $a; + $a = yield from $b; +} +// TODO Get rid of parens for last case +----- +!!php7 +function gen() +{ + $a = (yield $b); + $a = (yield $b => $c); + yield from $a; + $a = (yield from $b); +} \ No newline at end of file diff --git a/test/code/prettyPrinter/onlyPHP.file-test b/test/code/prettyPrinter/onlyPHP.file-test index 6b7ec49..32d1862 100644 --- a/test/code/prettyPrinter/onlyPHP.file-test +++ b/test/code/prettyPrinter/onlyPHP.file-test @@ -8,4 +8,9 @@ echo 'Bar Foo';