hg: amber/amber: Added more tests for switch expressions
Brian Goetz
brian.goetz at oracle.com
Mon Jul 9 14:57:53 UTC 2018
I really like the structure of these tests; you can test a lot with a
very small amount of code, and it gives us a chance to have tests cover
many more of the cases.
Code review comments:
- In testLambda(), you should test all the relevant nonlocal control
forms -- for example you leave out (RUNNABLE, BREAK_Z). (This will fail
type checking, rather than control flow checking, but its still a new
form that should be tested.) SImilarly (INT_FN, BREAK_N/L.)
- IN testEswitch, you should test (ESWITCH_Z, BREAK_S) for the right
type error. Similar for INT_FN_ESWITCH.
- It would be good to test BREAK_Z in nested (ESWITCH_Z, ESWITCH_Z),
and validate that the break target is selected correctly (that will be
harder to do with this particular framework)
- testBreakExpressionLabelDisambiguation should also cover a case like
(LABEL, FOR, BLOCK, DEF_LABEL_VAR, ESWITCH, BREAK_L), where the label is
outside the DEF_LABEL_VAR scope.
- A note regarding tests for preview features: when we promote the
feature to permanent, we will have to go back and fix the @compile lines
in these tests. (If we forget, when we get to 13, these tests will fail
as --enable-preview -source 12 will be an illegal combination.)
On 7/9/2018 10:02 AM, gavin.bierman at oracle.com wrote:
> Changeset: 10a0cdfd83ad
> Author: gbierman
> Date: 2018-07-09 15:02 +0100
> URL: http://hg.openjdk.java.net/amber/amber/rev/10a0cdfd83ad
>
> Added more tests for switch expressions
>
> ! test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java
> + test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java
> + test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java
> + test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java
> + test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.out
>
More information about the amber-dev
mailing list