Skip to content

Commit

Permalink
Rewrite for-each pattern variable completion tests to use regular for
Browse files Browse the repository at this point in the history
The syntax used in these tests was withdrawn before the feature was
delivered (see #1907).
I've altered the tests to use a regular for loop with an `instanceof` in it,
so that the tests still check that the scoping of the pattern variables
is working properly for completion.

Fixes #3589

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 authored and akurtakov committed Jan 28, 2025
1 parent 8a71d44 commit 2fd9321
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public void test012() throws JavaModelException {
+ " public static boolean foo(Object o) {\n"
+ " boolean ret = false;\n"
+ " R[] recArray = {new R(0)};\n"
+ " for (R(int x_1) : recArray) {\n"
+ " for (int i = 0; i < recArray.length && recArray[i] instanceof R(int x_1); i++) {\n"
+ " System.out.println(x_); \n"
+ " ret = true;\n"
+ " }\n"
Expand All @@ -490,7 +490,7 @@ public void test013() throws JavaModelException {
"/Completion/src/X.java",
"public class X {\n"
+ " public static void foo(ColoredRectangle[] array) {\n"
+ " for(ColoredRectangle(int x_1, int y_1, Color col) : array) {\n"
+ " for(int i = 0; i < array.length && array[i] instanceof ColoredRectangle(int x_1, int y_1, Color col); i++) {\n"
+ " int per = 2 * x_ + 2 * y_1;\n"
+ " }\n"
+ " }\n"
Expand All @@ -515,7 +515,7 @@ public void test014() throws JavaModelException {
"/Completion/src/X.java",
"public class X {\n"
+ " public static void foo(ColoredRectangle[] array) {\n"
+ " for(ColoredRectangle(int x_1, int y_1, Color col) : array) {\n"
+ " for(int i = 0; i < array.length && array[i] instanceof ColoredRectangle(int x_1, int y_1, Color col); i++) {\n"
+ " int per = 2 * x_1 + 2 * y_;\n"
+ " }\n"
+ " }\n"
Expand All @@ -540,7 +540,7 @@ public void test015() throws JavaModelException {
"/Completion/src/X.java",
"public class X {\n"
+ " public static void foo(ColoredRectangle[] ar_ray) {\n"
+ " for(ColoredRectangle(int x_1, int y_1, Color col) : ar_) {\n"
+ " for(int i = 0; i < ar_ray.length && ar_ray[i] instanceof ColoredRectangle(int x_1, int y_1, Color col); i++) {\n"
+ " int per = 2 * x_1 + 2 * y_1;\n"
+ " }\n"
+ " }\n"
Expand Down

0 comments on commit 2fd9321

Please sign in to comment.