diff options
author | Stephan Herrmann | 2010-12-11 19:33:06 +0000 |
---|---|---|
committer | Stephan Herrmann | 2010-12-11 19:33:06 +0000 |
commit | 1cd57131803081138a2298ded9b03083276a57f1 (patch) | |
tree | a3b16bea83ce6eee189e9751fbc5781d436e7e3d /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java | |
parent | d3c1c6ad12f31d9be2d2d6869a3e39bb23cf8a04 (diff) | |
download | org.eclipse.objectteams-1cd57131803081138a2298ded9b03083276a57f1.tar.gz org.eclipse.objectteams-1cd57131803081138a2298ded9b03083276a57f1.tar.xz org.eclipse.objectteams-1cd57131803081138a2298ded9b03083276a57f1.zip |
update jdt.core and tests to v_B28.
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java')
-rw-r--r-- | org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java | 124 |
1 files changed, 123 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java index c53e2dc91..eff8a90b8 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java @@ -33,7 +33,7 @@ public class EnumTest extends AbstractComparableTest { // All specified tests which does not belong to the class are skipped... static { // TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 181 }; +// TESTS_NUMBERS = new int[] { 182 }; // TESTS_RANGE = new int[] { 21, 50 }; } public static Test suite() { @@ -6542,4 +6542,126 @@ public void test181() { }, "SUCCESS"); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=328519 +public void test182() throws Exception { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR); + customOptions.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public static void main(String argv[]) {\n" + + " foo();\n" + + " }\n" + + " public static void foo() {\n" + + " int n = 0;\n" + + " for (E e : E.values()) {\n" + + " if (e.val() == E.VALUES[n++] ) {\n" + + " System.out.print(e.val());\n" + + " }\n" + + " }\n" + + " }\n" + + "}", + "E.java", + "enum E {\n" + + " a1(1), a2(2);\n" + + " static int[] VALUES = { 1, 2 };\n" + + " private int value;\n" + + " E(int v) {\n" + + " this.value = v;\n" + + " }\n" + + " public int val() {\n" + + " return this.value;\n" + + " }\n" + + "}" + }, + "12", + null/*classLibraries*/, + true/*shouldFlushOutputDirectory*/, + null, + customOptions, + null); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=328519 +public void test183() throws Exception { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR); + customOptions.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public static void main(String argv[]) {\n" + + " }\n" + + " static {\n" + + " int n = 0;\n" + + " for (E e : E.values()) {\n" + + " if (e.val() == E.VALUES[n++] ) {\n" + + " System.out.print(e.val());\n" + + " }\n" + + " }\n" + + " }\n" + + "}", + "E.java", + "enum E {\n" + + " a1(1), a2(2);\n" + + " static int[] VALUES = { 1, 2 };\n" + + " private int value;\n" + + " E(int v) {\n" + + " this.value = v;\n" + + " }\n" + + " public int val() {\n" + + " return this.value;\n" + + " }\n" + + "}" + }, + "12", + null/*classLibraries*/, + true/*shouldFlushOutputDirectory*/, + null, + customOptions, + null); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=328519 +public void test184() throws Exception { + Map customOptions = getCompilerOptions(); + customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR); + customOptions.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public static void main(String argv[]) {\n" + + " new X();\n" + + " }\n" + + " X() {\n" + + " int n = 0;\n" + + " for (E e : E.values()) {\n" + + " if (e.val() == E.VALUES[n++] ) {\n" + + " System.out.print(e.val());\n" + + " }\n" + + " }\n" + + " }\n" + + "}", + "E.java", + "enum E {\n" + + " a1(1), a2(2);\n" + + " static int[] VALUES = { 1, 2 };\n" + + " private int value;\n" + + " E(int v) {\n" + + " this.value = v;\n" + + " }\n" + + " public int val() {\n" + + " return this.value;\n" + + " }\n" + + "}" + }, + "12", + null/*classLibraries*/, + true/*shouldFlushOutputDirectory*/, + null, + customOptions, + null); +} } |